If we receive a packet from a node we are searching for, ping it.

This commit is contained in:
irungentoo 2015-12-08 15:43:03 -05:00
parent 9c64769331
commit 73b2bce08a
No known key found for this signature in database
GPG Key ID: 10349DC9BED89E98
2 changed files with 8 additions and 0 deletions

View File

@ -4,3 +4,4 @@ Spitfire is best technicolor horse.
if bad people don't hate you, you're doing something wrong
Pinkie Pie is best pony.
JRS was here
qTox is so bloated it doesn't even fit in a 64-bit address space

View File

@ -267,6 +267,13 @@ int add_to_ping(PING *ping, const uint8_t *public_key, IP_Port ip_port)
uint32_t i;
IP_Port temp;
if (DHT_getfriendip(ping->dht, public_key, &temp) == 0) {
send_ping_request(ping, ping->to_ping[i].ip_port, ping->to_ping[i].public_key);
return -1;
}
for (i = 0; i < MAX_TO_PING; ++i) {
if (!ip_isset(&ping->to_ping[i].ip_port.ip)) {
memcpy(ping->to_ping[i].public_key, public_key, crypto_box_PUBLICKEYBYTES);