diff options
author | irungentoo <irungentoo@gmail.com> | 2015-01-11 19:11:33 -0500 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2015-01-11 19:11:33 -0500 |
commit | dfc6be901cae5133286cbb16e6b651ff26bf2311 (patch) | |
tree | 8b2a5471da99a91ac421c349d9a44143f409dcdf /toxcore/onion_client.c | |
parent | 3b991212b7fdc6a4c9a656109dd43a9909cd11c2 (diff) |
Attempted fix of Tox killing routers.
This commit makes tox use one Onion_Client_Paths struct for all
friends instead of one per friend.
This should lower the number of ips tox sends packets to which is
what I think causes the router issues.
Diffstat (limited to 'toxcore/onion_client.c')
-rw-r--r-- | toxcore/onion_client.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/toxcore/onion_client.c b/toxcore/onion_client.c index b02b7c24..f8d7630b 100644 --- a/toxcore/onion_client.c +++ b/toxcore/onion_client.c | |||
@@ -249,9 +249,9 @@ static uint32_t set_path_timeouts(Onion_Client *onion_c, uint32_t num, uint32_t | |||
249 | Onion_Client_Paths *onion_paths; | 249 | Onion_Client_Paths *onion_paths; |
250 | 250 | ||
251 | if (num == 0) { | 251 | if (num == 0) { |
252 | onion_paths = &onion_c->onion_paths; | 252 | onion_paths = &onion_c->onion_paths_self; |
253 | } else { | 253 | } else { |
254 | onion_paths = &onion_c->friends_list[num - 1].onion_paths; | 254 | onion_paths = &onion_c->onion_paths_friends; |
255 | } | 255 | } |
256 | 256 | ||
257 | if (onion_paths->paths[path_num % NUMBER_ONION_PATHS].path_num == path_num) { | 257 | if (onion_paths->paths[path_num % NUMBER_ONION_PATHS].path_num == path_num) { |
@@ -377,10 +377,10 @@ static int client_send_announce_request(Onion_Client *onion_c, uint32_t num, IP_ | |||
377 | Onion_Path path; | 377 | Onion_Path path; |
378 | 378 | ||
379 | if (num == 0) { | 379 | if (num == 0) { |
380 | if (random_path(onion_c, &onion_c->onion_paths, pathnum, &path) == -1) | 380 | if (random_path(onion_c, &onion_c->onion_paths_self, pathnum, &path) == -1) |
381 | return -1; | 381 | return -1; |
382 | } else { | 382 | } else { |
383 | if (random_path(onion_c, &onion_c->friends_list[num - 1].onion_paths, pathnum, &path) == -1) | 383 | if (random_path(onion_c, &onion_c->onion_paths_friends, pathnum, &path) == -1) |
384 | return -1; | 384 | return -1; |
385 | } | 385 | } |
386 | 386 | ||
@@ -759,7 +759,7 @@ static int handle_tcp_onion(void *object, const uint8_t *data, uint16_t length) | |||
759 | * return the number of packets sent on success | 759 | * return the number of packets sent on success |
760 | * return -1 on failure. | 760 | * return -1 on failure. |
761 | */ | 761 | */ |
762 | int send_onion_data(const Onion_Client *onion_c, int friend_num, const uint8_t *data, uint16_t length) | 762 | int send_onion_data(Onion_Client *onion_c, int friend_num, const uint8_t *data, uint16_t length) |
763 | { | 763 | { |
764 | if ((uint32_t)friend_num >= onion_c->num_friends) | 764 | if ((uint32_t)friend_num >= onion_c->num_friends) |
765 | return -1; | 765 | return -1; |
@@ -792,7 +792,7 @@ int send_onion_data(const Onion_Client *onion_c, int friend_num, const uint8_t * | |||
792 | ++num_nodes; | 792 | ++num_nodes; |
793 | 793 | ||
794 | if (list_nodes[i].is_stored) { | 794 | if (list_nodes[i].is_stored) { |
795 | if (random_path(onion_c, &onion_c->friends_list[friend_num].onion_paths, ~0, &path[num_good]) == -1) | 795 | if (random_path(onion_c, &onion_c->onion_paths_friends, ~0, &path[num_good]) == -1) |
796 | continue; | 796 | continue; |
797 | 797 | ||
798 | good_nodes[num_good] = i; | 798 | good_nodes[num_good] = i; |
@@ -890,7 +890,7 @@ static int handle_dht_fakeid(void *object, IP_Port source, const uint8_t *source | |||
890 | * return the number of packets sent on success | 890 | * return the number of packets sent on success |
891 | * return -1 on failure. | 891 | * return -1 on failure. |
892 | */ | 892 | */ |
893 | static int send_fakeid_announce(const Onion_Client *onion_c, uint16_t friend_num, uint8_t onion_dht_both) | 893 | static int send_fakeid_announce(Onion_Client *onion_c, uint16_t friend_num, uint8_t onion_dht_both) |
894 | { | 894 | { |
895 | if (friend_num >= onion_c->num_friends) | 895 | if (friend_num >= onion_c->num_friends) |
896 | return -1; | 896 | return -1; |