home
·
contact
·
privacy
projects
/
plomrogue
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Client: Improve test_and_poll_server() ping test logic / timing.
[plomrogue]
/
src
/
client
/
io.c
diff --git
a/src/client/io.c
b/src/client/io.c
index 694ebfbfc43d2214842b5e14b1e722afb990b41a..ee4dcc2151a7a2ce87792a61a502ab03e6f47b11 100644
(file)
--- 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 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))
{
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;
{
send("PING");
ping_sent = 1;
+ last_pong_time = now;
return;
}
return;
}
- exit_err(
last_server_answer_time < now - 6
, "Server not answering.");
+ exit_err(
ping_sent && last_pong_time < now - 5
, "Server not answering.");
}
}