From 4b6aa0151724d8117df0d131748f4455a201b17b Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Sun, 28 Jul 2013 11:30:17 -0700 Subject: [PATCH] Unlock lock properly. --- src/protocols/rdp/guac_handlers.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/protocols/rdp/guac_handlers.c b/src/protocols/rdp/guac_handlers.c index 07ed591d..05162bce 100644 --- a/src/protocols/rdp/guac_handlers.c +++ b/src/protocols/rdp/guac_handlers.c @@ -187,6 +187,7 @@ int rdp_guac_client_handle_messages(guac_client* client) { if (!freerdp_check_fds(rdp_inst)) { guac_error = GUAC_STATUS_BAD_STATE; guac_error_message = "Error handling RDP file descriptors"; + pthread_mutex_unlock(&(guac_client_data->rdp_lock)); return 1; } @@ -194,6 +195,7 @@ int rdp_guac_client_handle_messages(guac_client* client) { if (!freerdp_channels_check_fds(channels, rdp_inst)) { guac_error = GUAC_STATUS_BAD_STATE; guac_error_message = "Error handling RDP channel file descriptors"; + pthread_mutex_unlock(&(guac_client_data->rdp_lock)); return 1; } @@ -218,6 +220,7 @@ int rdp_guac_client_handle_messages(guac_client* client) { if (freerdp_shall_disconnect(rdp_inst)) { guac_error = GUAC_STATUS_NO_INPUT; guac_error_message = "RDP server closed connection"; + pthread_mutex_unlock(&(guac_client_data->rdp_lock)); return 1; } @@ -248,6 +251,8 @@ int rdp_guac_client_handle_messages(guac_client* client) { FD_SET(fd, &wfds); } + pthread_mutex_unlock(&(guac_client_data->rdp_lock)); + } while (select(max_fd + 1, &rfds, &wfds, NULL, &timeout) > 0); /* Success */