Stay in handle_messages as long as possible for VNC as well.

This commit is contained in:
Michael Jumper 2013-07-28 11:30:49 -07:00
parent 4b6aa01517
commit acf5abe355

View File

@ -52,19 +52,25 @@ int vnc_guac_client_handle_messages(guac_client* client) {
int wait_result; int wait_result;
rfbClient* rfb_client = ((vnc_guac_client_data*) client->data)->rfb_client; rfbClient* rfb_client = ((vnc_guac_client_data*) client->data)->rfb_client;
/* Initially wait for messages */
wait_result = WaitForMessage(rfb_client, 1000000); wait_result = WaitForMessage(rfb_client, 1000000);
if (wait_result < 0) { while (wait_result > 0) {
guac_client_log_error(client, "Error waiting for VNC server message\n");
return 1;
}
if (wait_result > 0) {
/* Handle any message received */
if (!HandleRFBServerMessage(rfb_client)) { if (!HandleRFBServerMessage(rfb_client)) {
guac_client_log_error(client, "Error handling VNC server message\n"); guac_client_log_error(client, "Error handling VNC server message\n");
return 1; return 1;
} }
/* Check for additional messages */
wait_result = WaitForMessage(rfb_client, 0);
}
/* If an error occurs, log it and fail */
if (wait_result < 0) {
guac_client_log_error(client, "Error waiting for VNC server message\n");
return 1;
} }
return 0; return 0;