diff options
author | irungentoo <irungentoo@gmail.com> | 2014-08-12 20:56:46 -0400 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2014-08-12 20:56:46 -0400 |
commit | 19b07f7e80097f1a65c1e358140cd441d6ba67b6 (patch) | |
tree | 3720b4b72deb11755887f10bb8c6e711020e0057 | |
parent | db655c77f8089a152097fbd299e91ab18594ecdb (diff) |
Fixed bug that led to increased bandwidth usage.
-rw-r--r-- | toxcore/onion_client.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/toxcore/onion_client.c b/toxcore/onion_client.c index 2551a162..cffcb961 100644 --- a/toxcore/onion_client.c +++ b/toxcore/onion_client.c | |||
@@ -356,7 +356,7 @@ static int client_add_to_list(Onion_Client *onion_c, uint32_t num, const uint8_t | |||
356 | memcpy(cmp_public_key, reference_id, crypto_box_PUBLICKEYBYTES); | 356 | memcpy(cmp_public_key, reference_id, crypto_box_PUBLICKEYBYTES); |
357 | qsort(list_nodes, MAX_ONION_CLIENTS, sizeof(Onion_Node), cmp_entry); | 357 | qsort(list_nodes, MAX_ONION_CLIENTS, sizeof(Onion_Node), cmp_entry); |
358 | 358 | ||
359 | int index = -1; | 359 | int index = -1, stored = 0; |
360 | uint32_t i; | 360 | uint32_t i; |
361 | 361 | ||
362 | if (is_timeout(list_nodes[0].timestamp, ONION_NODE_TIMEOUT) | 362 | if (is_timeout(list_nodes[0].timestamp, ONION_NODE_TIMEOUT) |
@@ -367,6 +367,7 @@ static int client_add_to_list(Onion_Client *onion_c, uint32_t num, const uint8_t | |||
367 | for (i = 0; i < MAX_ONION_CLIENTS; ++i) { | 367 | for (i = 0; i < MAX_ONION_CLIENTS; ++i) { |
368 | if (memcmp(list_nodes[i].client_id, public_key, crypto_box_PUBLICKEYBYTES) == 0) { | 368 | if (memcmp(list_nodes[i].client_id, public_key, crypto_box_PUBLICKEYBYTES) == 0) { |
369 | index = i; | 369 | index = i; |
370 | stored = 1; | ||
370 | break; | 371 | break; |
371 | } | 372 | } |
372 | } | 373 | } |
@@ -390,7 +391,10 @@ static int client_add_to_list(Onion_Client *onion_c, uint32_t num, const uint8_t | |||
390 | 391 | ||
391 | list_nodes[index].is_stored = is_stored; | 392 | list_nodes[index].is_stored = is_stored; |
392 | list_nodes[index].timestamp = unix_time(); | 393 | list_nodes[index].timestamp = unix_time(); |
393 | list_nodes[index].last_pinged = 0; | 394 | |
395 | if (!stored) | ||
396 | list_nodes[index].last_pinged = 0; | ||
397 | |||
394 | list_nodes[index].path_used = set_path_timeouts(onion_c, num, path_num); | 398 | list_nodes[index].path_used = set_path_timeouts(onion_c, num, path_num); |
395 | return 0; | 399 | return 0; |
396 | } | 400 | } |