From 18871025052e6162be2658e7c5a6f7b49ac949e4 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Tue, 20 Aug 2013 21:13:26 -0700 Subject: [PATCH] Add frame timeout. Reduce frame max duration to 40ms. --- src/protocols/rdp/client.h | 9 ++++++++- src/protocols/rdp/guac_handlers.c | 2 +- src/protocols/vnc/client.h | 9 ++++++++- src/protocols/vnc/guac_handlers.c | 3 ++- 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/protocols/rdp/client.h b/src/protocols/rdp/client.h index c83f882c..be14e19e 100644 --- a/src/protocols/rdp/client.h +++ b/src/protocols/rdp/client.h @@ -54,7 +54,14 @@ /** * The maximum duration of a frame in milliseconds. */ -#define GUAC_RDP_FRAME_DURATION 80 +#define GUAC_RDP_FRAME_DURATION 40 + +/** + * The amount of time to allow per message read within a frame, in + * milliseconds. If the server is silent for at least this amount of time, the + * frame will be considered finished. + */ +#define GUAC_RDP_FRAME_TIMEOUT 15 /** * Client data that will remain accessible through the guac_client. diff --git a/src/protocols/rdp/guac_handlers.c b/src/protocols/rdp/guac_handlers.c index 2ab885be..258d2ead 100644 --- a/src/protocols/rdp/guac_handlers.c +++ b/src/protocols/rdp/guac_handlers.c @@ -260,7 +260,7 @@ int rdp_guac_client_handle_messages(guac_client* client) { /* Wait again if frame remaining */ if (frame_remaining > 0) wait_result = rdp_guac_client_wait_for_messages(client, - frame_remaining*1000); + GUAC_RDP_FRAME_TIMEOUT*1000); else break; diff --git a/src/protocols/vnc/client.h b/src/protocols/vnc/client.h index 8b19ed83..2f892566 100644 --- a/src/protocols/vnc/client.h +++ b/src/protocols/vnc/client.h @@ -47,7 +47,14 @@ /** * The maximum duration of a frame in milliseconds. */ -#define GUAC_VNC_FRAME_DURATION 80 +#define GUAC_VNC_FRAME_DURATION 40 + +/** + * The amount of time to allow per message read within a frame, in + * milliseconds. If the server is silent for at least this amount of time, the + * frame will be considered finished. + */ +#define GUAC_VNC_FRAME_TIMEOUT 15 extern char* __GUAC_CLIENT; diff --git a/src/protocols/vnc/guac_handlers.c b/src/protocols/vnc/guac_handlers.c index a66ea7eb..9b378f81 100644 --- a/src/protocols/vnc/guac_handlers.c +++ b/src/protocols/vnc/guac_handlers.c @@ -75,7 +75,8 @@ int vnc_guac_client_handle_messages(guac_client* client) { /* Wait again if frame remaining */ if (frame_remaining > 0) - wait_result = WaitForMessage(rfb_client, frame_remaining*1000); + wait_result = WaitForMessage(rfb_client, + GUAC_VNC_FRAME_TIMEOUT*1000); else break;