GUACAMOLE-1196: Use message lock where other RFB messages are sent.

This commit is contained in:
Virtually Nick 2024-06-01 10:15:09 -04:00
parent 0e7622ab4a
commit f4af20ae22
2 changed files with 11 additions and 1 deletions

View File

@ -259,13 +259,17 @@ void guac_vnc_display_set_size(rfbClient* client, int width, int height) {
/* Fit height within bounds, adjusting width to maintain aspect ratio */
guac_common_display_fit(&height, &width);
/* Send the display size update. */
/* Acquire the lock for sending messages to server. */
pthread_mutex_lock(&(vnc_client->message_lock));
/* Send the display size update. */
guac_client_log(gc, GUAC_LOG_TRACE, "Setting VNC display size.");
if (guac_vnc_send_desktop_size(client, width, height))
guac_client_log(gc, GUAC_LOG_TRACE, "Successfully sent desktop size message.");
else
guac_client_log(gc, GUAC_LOG_TRACE, "Failed to send desktop size message.");
/* Release the lock. */
pthread_mutex_unlock(&(vnc_client->message_lock));
}

View File

@ -456,11 +456,17 @@ void* guac_vnc_client_thread(void* data) {
msg.status = 1;
msg.pad = 0;
/* Acquire lock for writing to server. */
pthread_mutex_lock(&(vnc_client->message_lock));
if (WriteToRFBServer(rfb_client, (char*)&msg, sz_rfbSetServerInputMsg))
guac_client_log(client, GUAC_LOG_DEBUG, "Successfully sent request to disable server input.");
else
guac_client_log(client, GUAC_LOG_WARNING, "Failed to send request to disable server input.");
/* Release lock. */
pthread_mutex_unlock(&(vnc_client->message_lock));
}
/* Set remaining client data */