From: Christian Heller Date: Fri, 6 Feb 2015 01:11:11 +0000 (+0100) Subject: Client: Improve test_and_poll_server() ping test logic / timing. X-Git-Tag: tce~542 X-Git-Url: https://plomlompom.com/repos/?a=commitdiff_plain;h=030c92e213af6bd6f01fb0a0683fea9a6feacb65;p=plomrogue Client: Improve test_and_poll_server() ping test logic / timing. --- diff --git a/src/client/io.c b/src/client/io.c index 694ebfb..ee4dcc2 100644 --- a/src/client/io.c +++ b/src/client/io.c @@ -204,6 +204,7 @@ static uint8_t read_worldstate() static void test_and_poll_server() { static time_t last_server_answer_time = 0; + static time_t last_pong_time = 0; static uint8_t ping_sent = 0; if (read_file_into_queue(world.file_server_out, &world.queue)) { @@ -220,9 +221,10 @@ static void test_and_poll_server() { send("PING"); ping_sent = 1; + last_pong_time = now; return; } - exit_err(last_server_answer_time < now - 6, "Server not answering."); + exit_err(ping_sent && last_pong_time < now - 5, "Server not answering."); }