mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Update DHT.c
This commit is contained in:
parent
d62aec7db5
commit
c9063cf24a
|
@ -583,7 +583,7 @@ int handle_getnodes(uint8_t * packet, uint32_t length, IP_Port source)
|
||||||
|
|
||||||
int handle_sendnodes(uint8_t * packet, uint32_t length, IP_Port source)
|
int handle_sendnodes(uint8_t * packet, uint32_t length, IP_Port source)
|
||||||
{
|
{
|
||||||
uint64_t ping_id
|
uint64_t ping_id;
|
||||||
/* TODO: make this more readable */
|
/* TODO: make this more readable */
|
||||||
if(length > (1 + CLIENT_ID_SIZE + crypto_box_NONCEBYTES + sizeof(ping_id)
|
if(length > (1 + CLIENT_ID_SIZE + crypto_box_NONCEBYTES + sizeof(ping_id)
|
||||||
+ sizeof(Node_format) * MAX_SENT_NODES + ENCRYPTION_PADDING) ||
|
+ sizeof(Node_format) * MAX_SENT_NODES + ENCRYPTION_PADDING) ||
|
||||||
|
@ -906,10 +906,10 @@ int handle_NATping(uint8_t * packet, uint32_t length, IP_Port source)
|
||||||
if(friendnumber == -1)
|
if(friendnumber == -1)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
if(data[0] == 0)
|
if(data[0] == 0) {
|
||||||
send_NATping(public_key, ping_id, 1);/*1 is reply*/
|
send_NATping(public_key, ping_id, 1); /*1 is reply*/
|
||||||
return 0;
|
return 0;
|
||||||
else if (data[0] == 1)
|
} else if (data[0] == 1)
|
||||||
if(friends_list[friendnumber].NATping_id == ping_id) {
|
if(friends_list[friendnumber].NATping_id == ping_id) {
|
||||||
friends_list[friendnumber].NATping_id = ((uint64_t)random_int() << 32) + random_int();
|
friends_list[friendnumber].NATping_id = ((uint64_t)random_int() << 32) + random_int();
|
||||||
friends_list[friendnumber].hole_punching = 1;
|
friends_list[friendnumber].hole_punching = 1;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user