diff options
author | irungentoo <irungentoo@gmail.com> | 2015-12-11 15:07:46 -0500 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2015-12-11 15:07:46 -0500 |
commit | 1986a2e492cc45d442414e5bd39d219a97ae0f25 (patch) | |
tree | 2b2c757707755d02a2c990f99bb010d4aefa0259 | |
parent | 39700abd86cb2ffb13c8a428ddd75a00866f8a21 (diff) |
DHT fixes.
-rw-r--r-- | toxcore/DHT.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/toxcore/DHT.c b/toxcore/DHT.c index dc640562..b2fe59f4 100644 --- a/toxcore/DHT.c +++ b/toxcore/DHT.c | |||
@@ -733,7 +733,7 @@ static int replace_all( Client_data *list, | |||
733 | if ((ip_port.ip.family != AF_INET) && (ip_port.ip.family != AF_INET6)) | 733 | if ((ip_port.ip.family != AF_INET) && (ip_port.ip.family != AF_INET6)) |
734 | return 0; | 734 | return 0; |
735 | 735 | ||
736 | if (store_node_ok(&list[1], public_key, comp_public_key)) { | 736 | if (store_node_ok(&list[1], public_key, comp_public_key) || store_node_ok(&list[0], public_key, comp_public_key)) { |
737 | memcpy(cmp_public_key, comp_public_key, crypto_box_PUBLICKEYBYTES); | 737 | memcpy(cmp_public_key, comp_public_key, crypto_box_PUBLICKEYBYTES); |
738 | qsort(list, length, sizeof(Client_data), cmp_dht_entry); | 738 | qsort(list, length, sizeof(Client_data), cmp_dht_entry); |
739 | 739 | ||
@@ -779,12 +779,20 @@ static unsigned int ping_node_from_getnodes_ok(DHT *dht, const uint8_t *public_k | |||
779 | return 1; | 779 | return 1; |
780 | } | 780 | } |
781 | 781 | ||
782 | if (store_node_ok(&dht->close_clientlist[0], public_key, dht->self_public_key)) { | ||
783 | return 1; | ||
784 | } | ||
785 | |||
782 | unsigned int i; | 786 | unsigned int i; |
783 | 787 | ||
784 | for (i = 0; i < dht->num_friends; ++i) { | 788 | for (i = 0; i < dht->num_friends; ++i) { |
785 | if (store_node_ok(&dht->friends_list[i].client_list[1], public_key, dht->self_public_key)) { | 789 | if (store_node_ok(&dht->friends_list[i].client_list[1], public_key, dht->self_public_key)) { |
786 | return 1; | 790 | return 1; |
787 | } | 791 | } |
792 | |||
793 | if (store_node_ok(&dht->friends_list[i].client_list[0], public_key, dht->self_public_key)) { | ||
794 | return 1; | ||
795 | } | ||
788 | } | 796 | } |
789 | 797 | ||
790 | return 0; | 798 | return 0; |