diff --git a/src/protocols/vnc/client.h b/src/protocols/vnc/client.h index 36f5870e..316d3883 100644 --- a/src/protocols/vnc/client.h +++ b/src/protocols/vnc/client.h @@ -38,6 +38,15 @@ */ #define GUAC_VNC_FRAME_TIMEOUT 10 +/** + * The amount of time to wait for a new message from the VNC server when + * beginning a new frame. This value must be kept reasonably small such that + * a slow VNC server will not prevent external events from being handled (such + * as the stop signal from guac_client_stop()), but large enough that the + * message handling loop does not eat up CPU spinning. + */ +#define GUAC_VNC_FRAME_START_TIMEOUT 1000000 + /** * The number of milliseconds to wait between connection attempts. */ diff --git a/src/protocols/vnc/vnc.c b/src/protocols/vnc/vnc.c index f192996b..155c9209 100644 --- a/src/protocols/vnc/vnc.c +++ b/src/protocols/vnc/vnc.c @@ -341,7 +341,8 @@ void* guac_vnc_client_thread(void* data) { while (client->state == GUAC_CLIENT_RUNNING) { /* Wait for start of frame */ - int wait_result = guac_vnc_wait_for_messages(rfb_client, 1000000); + int wait_result = guac_vnc_wait_for_messages(rfb_client, + GUAC_VNC_FRAME_START_TIMEOUT); if (wait_result > 0) { guac_timestamp frame_start = guac_timestamp_current();