diff options
author | nfkd <nfkd@koszmial.pl> | 2013-07-26 21:54:02 -0300 |
---|---|---|
committer | nfkd <nfkd@koszmial.pl> | 2013-07-26 21:54:02 -0300 |
commit | c9063cf24a37540f47f88dcad19e689312e5a80d (patch) | |
tree | 7366ebce473f668262a44acbb346cf5a5b8f6133 | |
parent | d62aec7db5392842eb6b43b9198318178005ca7c (diff) |
Update DHT.c
-rw-r--r-- | core/DHT.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -583,7 +583,7 @@ int handle_getnodes(uint8_t * packet, uint32_t length, IP_Port source) | |||
583 | 583 | ||
584 | int handle_sendnodes(uint8_t * packet, uint32_t length, IP_Port source) | 584 | int handle_sendnodes(uint8_t * packet, uint32_t length, IP_Port source) |
585 | { | 585 | { |
586 | uint64_t ping_id | 586 | uint64_t ping_id; |
587 | /* TODO: make this more readable */ | 587 | /* TODO: make this more readable */ |
588 | if(length > (1 + CLIENT_ID_SIZE + crypto_box_NONCEBYTES + sizeof(ping_id) | 588 | if(length > (1 + CLIENT_ID_SIZE + crypto_box_NONCEBYTES + sizeof(ping_id) |
589 | + sizeof(Node_format) * MAX_SENT_NODES + ENCRYPTION_PADDING) || | 589 | + sizeof(Node_format) * MAX_SENT_NODES + ENCRYPTION_PADDING) || |
@@ -906,10 +906,10 @@ int handle_NATping(uint8_t * packet, uint32_t length, IP_Port source) | |||
906 | if(friendnumber == -1) | 906 | if(friendnumber == -1) |
907 | return 1; | 907 | return 1; |
908 | 908 | ||
909 | if(data[0] == 0) | 909 | if(data[0] == 0) { |
910 | send_NATping(public_key, ping_id, 1);/*1 is reply*/ | 910 | send_NATping(public_key, ping_id, 1); /*1 is reply*/ |
911 | return 0; | 911 | return 0; |
912 | else if (data[0] == 1) | 912 | } else if (data[0] == 1) |
913 | if(friends_list[friendnumber].NATping_id == ping_id) { | 913 | if(friends_list[friendnumber].NATping_id == ping_id) { |
914 | friends_list[friendnumber].NATping_id = ((uint64_t)random_int() << 32) + random_int(); | 914 | friends_list[friendnumber].NATping_id = ((uint64_t)random_int() << 32) + random_int(); |
915 | friends_list[friendnumber].hole_punching = 1; | 915 | friends_list[friendnumber].hole_punching = 1; |