diff options
-rw-r--r-- | toxcore/DHT.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/toxcore/DHT.c b/toxcore/DHT.c index 1edc86ae..dc640562 100644 --- a/toxcore/DHT.c +++ b/toxcore/DHT.c | |||
@@ -733,15 +733,15 @@ 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 | memcpy(cmp_public_key, comp_public_key, crypto_box_PUBLICKEYBYTES); | 736 | if (store_node_ok(&list[1], public_key, comp_public_key)) { |
737 | qsort(list, length, sizeof(Client_data), cmp_dht_entry); | 737 | memcpy(cmp_public_key, comp_public_key, crypto_box_PUBLICKEYBYTES); |
738 | qsort(list, length, sizeof(Client_data), cmp_dht_entry); | ||
738 | 739 | ||
739 | Client_data *client = &list[0]; | ||
740 | |||
741 | if (store_node_ok(client, public_key, comp_public_key)) { | ||
742 | IPPTsPng *ipptp_write = NULL; | 740 | IPPTsPng *ipptp_write = NULL; |
743 | IPPTsPng *ipptp_clear = NULL; | 741 | IPPTsPng *ipptp_clear = NULL; |
744 | 742 | ||
743 | Client_data *client = &list[0]; | ||
744 | |||
745 | if (ip_port.ip.family == AF_INET) { | 745 | if (ip_port.ip.family == AF_INET) { |
746 | ipptp_write = &client->assoc4; | 746 | ipptp_write = &client->assoc4; |
747 | ipptp_clear = &client->assoc6; | 747 | ipptp_clear = &client->assoc6; |
@@ -1375,7 +1375,6 @@ static void divide_by_2(uint8_t *public_key) | |||
1375 | static void find_midpoint(uint8_t *out, const uint8_t *top, const uint8_t *bot) | 1375 | static void find_midpoint(uint8_t *out, const uint8_t *top, const uint8_t *bot) |
1376 | { | 1376 | { |
1377 | unsigned int i; | 1377 | unsigned int i; |
1378 | _Bool one = 0; | ||
1379 | 1378 | ||
1380 | for (i = 0; i < crypto_box_PUBLICKEYBYTES; ++i) { | 1379 | for (i = 0; i < crypto_box_PUBLICKEYBYTES; ++i) { |
1381 | out[i] = top[i] ^ bot[i]; | 1380 | out[i] = top[i] ^ bot[i]; |