summaryrefslogtreecommitdiff
path: root/toxcore/onion_client.c
diff options
context:
space:
mode:
Diffstat (limited to 'toxcore/onion_client.c')
-rw-r--r--toxcore/onion_client.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/toxcore/onion_client.c b/toxcore/onion_client.c
index ca92ee42..6ee1fe75 100644
--- a/toxcore/onion_client.c
+++ b/toxcore/onion_client.c
@@ -253,16 +253,9 @@ static int client_add_to_list(Onion_Client *onion_c, uint32_t num, uint8_t *publ
253 int index = -1; 253 int index = -1;
254 uint32_t i; 254 uint32_t i;
255 255
256 for (i = 0; i < MAX_ONION_CLIENTS; ++i) { 256 if (is_timeout(list_nodes[0].timestamp, ONION_NODE_TIMEOUT)
257 if (is_timeout(list_nodes[i].timestamp, ONION_NODE_TIMEOUT) 257 || id_closest(reference_id, list_nodes[0].client_id, public_key) == 2) {
258 || id_closest(reference_id, list_nodes[i].client_id, public_key) == 2) { 258 index = 0;
259 index = i;
260
261 if (i != 0)
262 break;
263 } else {
264 break;
265 }
266 } 259 }
267 260
268 for (i = 0; i < MAX_ONION_CLIENTS; ++i) { 261 for (i = 0; i < MAX_ONION_CLIENTS; ++i) {