Skip to content

Commit

Permalink
GUACAMOLE-377: Restore heuristic detection of VNC frame boundaries.
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-jumper committed Sep 11, 2024
1 parent ee06558 commit a912fab
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 29 deletions.
2 changes: 1 addition & 1 deletion src/protocols/vnc/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* milliseconds. If the server is silent for at least this amount of time, the
* frame will be considered finished.
*/
#define GUAC_VNC_FRAME_TIMEOUT 0
#define GUAC_VNC_FRAME_TIMEOUT 16

/**
* The amount of time to wait for a new message from the VNC server when
Expand Down
9 changes: 0 additions & 9 deletions src/protocols/vnc/display.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,15 +138,6 @@ void guac_vnc_update(rfbClient* client, int x, int y, int w, int h) {

}

void guac_vnc_update_finished(rfbClient* client) {

guac_client* gc = rfbClientGetClientData(client, GUAC_VNC_CLIENT_KEY);
guac_vnc_client* vnc_client = (guac_vnc_client*) gc->data;

guac_display_end_multiple_frames(vnc_client->display, 1);

}

void guac_vnc_copyrect(rfbClient* client, int src_x, int src_y, int w, int h, int dest_x, int dest_y) {

guac_client* gc = rfbClientGetClientData(client, GUAC_VNC_CLIENT_KEY);
Expand Down
11 changes: 0 additions & 11 deletions src/protocols/vnc/display.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,6 @@
*/
void guac_vnc_update(rfbClient* client, int x, int y, int w, int h);

/**
* Callback invoked by libVNCServer when all binary image data for the current
* frame has been received from the VNC server. The image data that frame will
* have been exposed via previous calls to guac_vnc_update().
*
* @param client
* The VNC client associated with the VNC session in which the new image
* was received.
*/
void guac_vnc_update_finished(rfbClient* client);

/**
* Callback invoked by libVNCServer when it receives a CopyRect message.
* CopyRect specified a rectangle of source data within the display and a
Expand Down
23 changes: 15 additions & 8 deletions src/protocols/vnc/vnc.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ rfbClient* guac_vnc_get_client(guac_client* client) {

/* Framebuffer update handler */
rfb_client->GotFrameBufferUpdate = guac_vnc_update;
rfb_client->FinishedFrameBufferUpdate = guac_vnc_update_finished;
rfb_client->GotCopyRect = guac_vnc_copyrect;

#ifdef ENABLE_VNC_TLS_LOCKING
Expand Down Expand Up @@ -553,18 +552,26 @@ void* guac_vnc_client_thread(void* data) {
if (wait_result == 0)
continue;

/* Handle any message received */
if (!HandleRFBServerMessage(rfb_client)) {
guac_client_abort(client,
GUAC_PROTOCOL_STATUS_UPSTREAM_ERROR,
"Error handling message from VNC server.");
break;
}
do {

/* Handle any message received */
if (!HandleRFBServerMessage(rfb_client)) {
guac_client_abort(client,
GUAC_PROTOCOL_STATUS_UPSTREAM_ERROR,
"Error handling message from VNC server.");
break;
}

wait_result = guac_vnc_wait_for_messages(rfb_client, GUAC_VNC_FRAME_TIMEOUT);

} while (wait_result > 0);

/* If an error occurs, log it and fail */
if (wait_result < 0)
guac_client_abort(client, GUAC_PROTOCOL_STATUS_UPSTREAM_ERROR, "Connection closed.");

guac_display_end_frame(vnc_client->display);

}

/* Kill client and finish connection */
Expand Down

0 comments on commit a912fab

Please sign in to comment.