diff options
Diffstat (limited to 'toxcore/ping.c')
-rw-r--r-- | toxcore/ping.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/toxcore/ping.c b/toxcore/ping.c index 09b80f0d..b9940ce1 100644 --- a/toxcore/ping.c +++ b/toxcore/ping.c | |||
@@ -15,7 +15,7 @@ | |||
15 | #include "net_crypto.h" | 15 | #include "net_crypto.h" |
16 | #include "DHT.h" | 16 | #include "DHT.h" |
17 | 17 | ||
18 | #define PING_NUM_MAX 256 | 18 | #define PING_NUM_MAX 384 |
19 | #define PING_TIMEOUT 5 // 5s | 19 | #define PING_TIMEOUT 5 // 5s |
20 | 20 | ||
21 | /* Ping newly announced nodes to ping per TIME_TOPING seconds*/ | 21 | /* Ping newly announced nodes to ping per TIME_TOPING seconds*/ |
@@ -180,6 +180,7 @@ static int handle_ping_request(void *_dht, IP_Port source, uint8_t *packet, uint | |||
180 | return 1; | 180 | return 1; |
181 | 181 | ||
182 | PING *ping = dht->ping; | 182 | PING *ping = dht->ping; |
183 | |||
183 | if (id_eq(packet + 1, ping->c->self_public_key)) | 184 | if (id_eq(packet + 1, ping->c->self_public_key)) |
184 | return 1; | 185 | return 1; |
185 | 186 | ||
@@ -211,6 +212,7 @@ static int handle_ping_response(void *_dht, IP_Port source, uint8_t *packet, uin | |||
211 | return 1; | 212 | return 1; |
212 | 213 | ||
213 | PING *ping = dht->ping; | 214 | PING *ping = dht->ping; |
215 | |||
214 | if (id_eq(packet + 1, ping->c->self_public_key)) | 216 | if (id_eq(packet + 1, ping->c->self_public_key)) |
215 | return 1; | 217 | return 1; |
216 | 218 | ||
@@ -283,7 +285,7 @@ static int is_timeout(uint64_t time_now, uint64_t timestamp, uint64_t timeout) | |||
283 | void do_toping(PING *ping) | 285 | void do_toping(PING *ping) |
284 | { | 286 | { |
285 | uint64_t temp_time = unix_time(); | 287 | uint64_t temp_time = unix_time(); |
286 | 288 | ||
287 | if (!is_timeout(temp_time, ping->last_toping, TIME_TOPING)) | 289 | if (!is_timeout(temp_time, ping->last_toping, TIME_TOPING)) |
288 | return; | 290 | return; |
289 | 291 | ||
@@ -303,6 +305,7 @@ void do_toping(PING *ping) | |||
303 | PING *new_ping(DHT *dht, Net_Crypto *c) | 305 | PING *new_ping(DHT *dht, Net_Crypto *c) |
304 | { | 306 | { |
305 | PING *ping = calloc(1, sizeof(PING)); | 307 | PING *ping = calloc(1, sizeof(PING)); |
308 | |||
306 | if (ping == NULL) | 309 | if (ping == NULL) |
307 | return NULL; | 310 | return NULL; |
308 | 311 | ||