summaryrefslogtreecommitdiff
path: root/toxcore/DHT.c
diff options
context:
space:
mode:
Diffstat (limited to 'toxcore/DHT.c')
-rw-r--r--toxcore/DHT.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/toxcore/DHT.c b/toxcore/DHT.c
index b736d55e..d5808313 100644
--- a/toxcore/DHT.c
+++ b/toxcore/DHT.c
@@ -2135,21 +2135,18 @@ uint16_t random_nodes_path(DHT *dht, Node_format *nodes, uint16_t max_num)
2135 if (max_num == 0) 2135 if (max_num == 0)
2136 return 0; 2136 return 0;
2137 2137
2138 if (dht->num_friends == 0)
2139 return 0;
2140
2138 uint16_t count = 0; 2141 uint16_t count = 0;
2139 Client_data *list = NULL; 2142 Client_data *list = NULL;
2140 uint16_t list_size = 0; 2143 uint16_t list_size = 0;
2141 uint32_t i; 2144 uint32_t i;
2142 2145
2143 for (i = 0; i < max_num; ++i) { 2146 for (i = 0; i < max_num; ++i) {
2144 uint16_t rand_num = rand() % (dht->num_friends + 1); 2147 uint16_t rand_num = rand() % (dht->num_friends);
2145 2148 list = dht->friends_list[rand_num].client_list;
2146 if (rand_num == dht->num_friends) { 2149 list_size = MAX_FRIEND_CLIENTS;
2147 list = dht->close_clientlist;
2148 list_size = LCLIENT_LIST;
2149 } else {
2150 list = dht->friends_list[rand_num].client_list;
2151 list_size = MAX_FRIEND_CLIENTS;
2152 }
2153 2150
2154 uint8_t LAN_ok = 1; 2151 uint8_t LAN_ok = 1;
2155 2152