GUAC-1164: Init/uninit common SSH client only once. Do not touch display if RDP server is not connected.
This commit is contained in:
parent
0a1f01ce3f
commit
1cb4325422
@ -165,9 +165,6 @@ int guac_rdp_user_mouse_handler(guac_user* user, int x, int y, int mask) {
|
||||
|
||||
pthread_mutex_lock(&(rdp_client->rdp_lock));
|
||||
|
||||
/* Store current mouse location */
|
||||
guac_common_cursor_move(rdp_client->display->cursor, user, x, y);
|
||||
|
||||
/* Skip if not yet connected */
|
||||
freerdp* rdp_inst = rdp_client->rdp_inst;
|
||||
if (rdp_inst == NULL) {
|
||||
@ -175,6 +172,9 @@ int guac_rdp_user_mouse_handler(guac_user* user, int x, int y, int mask) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Store current mouse location */
|
||||
guac_common_cursor_move(rdp_client->display->cursor, user, x, y);
|
||||
|
||||
/* If button mask unchanged, just send move event */
|
||||
if (mask == rdp_client->mouse_button_mask)
|
||||
rdp_inst->input->MouseEvent(rdp_inst->input, PTR_FLAGS_MOVE, x, y);
|
||||
|
@ -764,8 +764,6 @@ static int guac_rdp_handle_connection(guac_client* client) {
|
||||
__guac_rdp_client_load_keymap(client, settings->server_layout);
|
||||
|
||||
#ifdef ENABLE_COMMON_SSH
|
||||
guac_common_ssh_init(client);
|
||||
|
||||
/* Connect via SSH if SFTP is enabled */
|
||||
if (settings->enable_sftp) {
|
||||
|
||||
@ -993,6 +991,7 @@ static int guac_rdp_handle_connection(guac_client* client) {
|
||||
|
||||
/* Clean up RDP client */
|
||||
freerdp_free(rdp_inst);
|
||||
rdp_client->rdp_inst = NULL;
|
||||
|
||||
/* Clean up filesystem, if allocated */
|
||||
if (rdp_client->filesystem != NULL)
|
||||
@ -1014,8 +1013,6 @@ static int guac_rdp_handle_connection(guac_client* client) {
|
||||
/* Free SFTP user */
|
||||
if (rdp_client->sftp_user)
|
||||
guac_common_ssh_destroy_user(rdp_client->sftp_user);
|
||||
|
||||
guac_common_ssh_uninit();
|
||||
#endif
|
||||
|
||||
/* Free SVC list */
|
||||
@ -1024,9 +1021,6 @@ static int guac_rdp_handle_connection(guac_client* client) {
|
||||
/* Free display */
|
||||
guac_common_display_free(rdp_client->display);
|
||||
|
||||
/* Mark FreeRDP instance as freed */
|
||||
rdp_client->rdp_inst = NULL;
|
||||
|
||||
pthread_mutex_unlock(&(rdp_client->rdp_lock));
|
||||
return 0;
|
||||
|
||||
@ -1036,13 +1030,20 @@ void* guac_rdp_client_thread(void* data) {
|
||||
|
||||
guac_client* client = (guac_client*) data;
|
||||
|
||||
#ifdef ENABLE_COMMON_SSH
|
||||
guac_common_ssh_init(client);
|
||||
#endif
|
||||
|
||||
/* Continue handling connections until error or client disconnect */
|
||||
while (client->state == GUAC_CLIENT_RUNNING) {
|
||||
|
||||
if (guac_rdp_handle_connection(client))
|
||||
return NULL;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_COMMON_SSH
|
||||
guac_common_ssh_uninit();
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user