summaryrefslogtreecommitdiff
path: root/toxcore/ping.c
diff options
context:
space:
mode:
Diffstat (limited to 'toxcore/ping.c')
-rw-r--r--toxcore/ping.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/toxcore/ping.c b/toxcore/ping.c
index 6a480f6f..2c6125e8 100644
--- a/toxcore/ping.c
+++ b/toxcore/ping.c
@@ -39,10 +39,10 @@
39#define PING_NUM_MAX 512 39#define PING_NUM_MAX 512
40 40
41/* Maximum newly announced nodes to ping per TIME_TO_PING seconds. */ 41/* Maximum newly announced nodes to ping per TIME_TO_PING seconds. */
42#define MAX_TO_PING 16 42#define MAX_TO_PING 32
43 43
44/* Ping newly announced nodes to ping per TIME_TO_PING seconds*/ 44/* Ping newly announced nodes to ping per TIME_TO_PING seconds*/
45#define TIME_TO_PING 4 45#define TIME_TO_PING 2
46 46
47 47
48struct PING { 48struct PING {
@@ -262,9 +262,11 @@ int add_to_ping(PING *ping, const uint8_t *public_key, IP_Port ip_port)
262 if (!ip_isset(&ip_port.ip)) 262 if (!ip_isset(&ip_port.ip))
263 return -1; 263 return -1;
264 264
265 if (in_list(ping->dht->close_clientlist, LCLIENT_LIST, public_key, ip_port)) 265 if (!node_addable_to_close_list(ping->dht, public_key, ip_port))
266 return -1; 266 return -1;
267 267
268 if (in_list(ping->dht->close_clientlist, LCLIENT_LIST, public_key, ip_port))
269 return -1;
268 270
269 IP_Port temp; 271 IP_Port temp;
270 272
@@ -311,6 +313,9 @@ void do_to_ping(PING *ping)
311 if (!ip_isset(&ping->to_ping[i].ip_port.ip)) 313 if (!ip_isset(&ping->to_ping[i].ip_port.ip))
312 break; 314 break;
313 315
316 if (!node_addable_to_close_list(ping->dht, ping->to_ping[i].public_key, ping->to_ping[i].ip_port))
317 continue;
318
314 send_ping_request(ping, ping->to_ping[i].ip_port, ping->to_ping[i].public_key); 319 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); 320 ip_reset(&ping->to_ping[i].ip_port.ip);
316 } 321 }