diff options
author | irungentoo <irungentoo@gmail.com> | 2015-05-07 20:58:39 -0400 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2015-05-07 20:58:39 -0400 |
commit | 6a4c2e8fc680824c978f0b69aca7f1ac940c4cf1 (patch) | |
tree | 0c10bda3cd22f738a42ee33668436b9e47854dd9 /toxcore/ping.c | |
parent | 3d70fe126cb9ff55096aaac2943da1687e15ee0d (diff) |
Only set last_to_ping if at least one node was pinged,
Diffstat (limited to 'toxcore/ping.c')
-rw-r--r-- | toxcore/ping.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/toxcore/ping.c b/toxcore/ping.c index 1c3564a3..2decca0a 100644 --- a/toxcore/ping.c +++ b/toxcore/ping.c | |||
@@ -304,16 +304,18 @@ void do_to_ping(PING *ping) | |||
304 | if (!ip_isset(&ping->to_ping[0].ip_port.ip)) | 304 | if (!ip_isset(&ping->to_ping[0].ip_port.ip)) |
305 | return; | 305 | return; |
306 | 306 | ||
307 | ping->last_to_ping = unix_time(); | ||
308 | uint32_t i; | 307 | uint32_t i; |
309 | 308 | ||
310 | for (i = 0; i < MAX_TO_PING; ++i) { | 309 | for (i = 0; i < MAX_TO_PING; ++i) { |
311 | if (!ip_isset(&ping->to_ping[i].ip_port.ip)) | 310 | if (!ip_isset(&ping->to_ping[i].ip_port.ip)) |
312 | return; | 311 | break; |
313 | 312 | ||
314 | send_ping_request(ping, ping->to_ping[i].ip_port, ping->to_ping[i].public_key); | 313 | send_ping_request(ping, ping->to_ping[i].ip_port, ping->to_ping[i].public_key); |
315 | ip_reset(&ping->to_ping[i].ip_port.ip); | 314 | ip_reset(&ping->to_ping[i].ip_port.ip); |
316 | } | 315 | } |
316 | |||
317 | if (i != 0) | ||
318 | ping->last_to_ping = unix_time(); | ||
317 | } | 319 | } |
318 | 320 | ||
319 | 321 | ||