From 6a4c2e8fc680824c978f0b69aca7f1ac940c4cf1 Mon Sep 17 00:00:00 2001 From: irungentoo Date: Thu, 7 May 2015 20:58:39 -0400 Subject: [PATCH] Only set last_to_ping if at least one node was pinged, --- toxcore/ping.c | 6 ++++-- 1 file 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) if (!ip_isset(&ping->to_ping[0].ip_port.ip)) return; - ping->last_to_ping = unix_time(); uint32_t i; for (i = 0; i < MAX_TO_PING; ++i) { if (!ip_isset(&ping->to_ping[i].ip_port.ip)) - return; + break; send_ping_request(ping, ping->to_ping[i].ip_port, ping->to_ping[i].public_key); ip_reset(&ping->to_ping[i].ip_port.ip); } + + if (i != 0) + ping->last_to_ping = unix_time(); }