summaryrefslogtreecommitdiff
path: root/toxcore/DHT.c
diff options
context:
space:
mode:
Diffstat (limited to 'toxcore/DHT.c')
-rw-r--r--toxcore/DHT.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/toxcore/DHT.c b/toxcore/DHT.c
index 4908de32..6b2715ee 100644
--- a/toxcore/DHT.c
+++ b/toxcore/DHT.c
@@ -2741,10 +2741,12 @@ DHT *new_dht(const Logger *log, Mono_Time *mono_time, Networking_Core *net, bool
2741 dht->dht_harden_ping_array = ping_array_new(DHT_PING_ARRAY_SIZE, PING_TIMEOUT); 2741 dht->dht_harden_ping_array = ping_array_new(DHT_PING_ARRAY_SIZE, PING_TIMEOUT);
2742 2742
2743 for (uint32_t i = 0; i < DHT_FAKE_FRIEND_NUMBER; ++i) { 2743 for (uint32_t i = 0; i < DHT_FAKE_FRIEND_NUMBER; ++i) {
2744 uint8_t random_key_bytes[CRYPTO_PUBLIC_KEY_SIZE]; 2744 uint8_t random_public_key_bytes[CRYPTO_PUBLIC_KEY_SIZE];
2745 random_bytes(random_key_bytes, sizeof(random_key_bytes)); 2745 uint8_t random_secret_key_bytes[CRYPTO_SECRET_KEY_SIZE];
2746 2746
2747 if (dht_addfriend(dht, random_key_bytes, nullptr, nullptr, 0, nullptr) != 0) { 2747 crypto_new_keypair(random_public_key_bytes, random_secret_key_bytes);
2748
2749 if (dht_addfriend(dht, random_public_key_bytes, nullptr, nullptr, 0, nullptr) != 0) {
2748 kill_dht(dht); 2750 kill_dht(dht);
2749 return nullptr; 2751 return nullptr;
2750 } 2752 }