From f55ba6ff4e662879ebf4c513c36e17ea81b6a155 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Thu, 14 Jul 2011 09:57:14 -0700 Subject: [PATCH] Ping with last sync, not new sync. Don't want to update the last update timestamp unnecessarily. --- libguac/src/client.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libguac/src/client.c b/libguac/src/client.c index cdc0cc43..9a48911f 100644 --- a/libguac/src/client.c +++ b/libguac/src/client.c @@ -263,15 +263,17 @@ void* __guac_client_output_thread(void* data) { guac_client* client = (guac_client*) data; GUACIO* io = client->io; + guac_timestamp_t last_ping_timestamp = guac_current_timestamp(); + /* Guacamole client output loop */ while (client->state == RUNNING) { - /* Occasionally ping client with sync */ + /* Occasionally ping client with repeat of last sync */ guac_timestamp_t timestamp = guac_current_timestamp(); - if (timestamp - client->last_sent_timestamp > GUAC_SYNC_FREQUENCY) { - client->last_sent_timestamp = timestamp; + if (timestamp - last_ping_timestamp > GUAC_SYNC_FREQUENCY) { + last_ping_timestamp = timestamp; if ( - guac_send_sync(io, timestamp) + guac_send_sync(io, client->last_sent_timestamp) || guac_flush(io) ) { guac_client_stop(client);