From: Christian Heller Date: Thu, 13 Nov 2014 21:38:09 +0000 (+0100) Subject: Client: Abort test_ping_pong() earlier when server known to be active. X-Git-Tag: tce~605 X-Git-Url: https://plomlompom.com/repos/balance?a=commitdiff_plain;h=4e4313a0162999f961db391a2dcf943128040e56;p=plomrogue Client: Abort test_ping_pong() earlier when server known to be active. --- diff --git a/src/client/io.c b/src/client/io.c index ec72478..b3724b5 100644 --- a/src/client/io.c +++ b/src/client/io.c @@ -237,9 +237,10 @@ static void test_ping_pong(time_t last_server_answer_time) { static uint8_t ping_sent = 0; time_t now = time(0); - if (ping_sent && last_server_answer_time > now - 3) - { - ping_sent = 0; + if (ping_sent && last_server_answer_time > now - 3) /* Re-set if last */ + { /* ping was answered */ + ping_sent = 0; /* with server */ + return; /* activity. */ } if (!ping_sent && last_server_answer_time < now - 3) { diff --git a/src/client/io.h b/src/client/io.h index 344a8ee..33fc671 100644 --- a/src/client/io.h +++ b/src/client/io.h @@ -20,7 +20,7 @@ */ extern void send(char * msg); -/* Keep checking for user input, a changed worldstate file and the server's +/* Keep checking for user input, a changed worldstate file, and the server's * wakefulness. Update client's world representation on worldstate file changes. * Manipulate the client and send commands to server based on the user input as * interpreted by the control.h library.