Only set last_to_ping if at least one node was pinged,

This commit is contained in:
irungentoo 2015-05-07 20:58:39 -04:00
parent 3d70fe126c
commit 6a4c2e8fc6
No known key found for this signature in database
GPG Key ID: 10349DC9BED89E98

View File

@ -304,16 +304,18 @@ void do_to_ping(PING *ping)
if (!ip_isset(&ping->to_ping[0].ip_port.ip)) if (!ip_isset(&ping->to_ping[0].ip_port.ip))
return; return;
ping->last_to_ping = unix_time();
uint32_t i; uint32_t i;
for (i = 0; i < MAX_TO_PING; ++i) { for (i = 0; i < MAX_TO_PING; ++i) {
if (!ip_isset(&ping->to_ping[i].ip_port.ip)) 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); 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); ip_reset(&ping->to_ping[i].ip_port.ip);
} }
if (i != 0)
ping->last_to_ping = unix_time();
} }