diff options
-rw-r--r-- | toxcore/onion_client.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/toxcore/onion_client.c b/toxcore/onion_client.c index 9153216d..b02b7c24 100644 --- a/toxcore/onion_client.c +++ b/toxcore/onion_client.c | |||
@@ -1188,6 +1188,18 @@ static void populate_path_nodes(Onion_Client *onion_c) | |||
1188 | } | 1188 | } |
1189 | } | 1189 | } |
1190 | 1190 | ||
1191 | static void populate_path_nodes_tcp(Onion_Client *onion_c) | ||
1192 | { | ||
1193 | Node_format nodes_list[MAX_SENT_NODES]; | ||
1194 | |||
1195 | unsigned int num_nodes = copy_connected_tcp_relays(onion_c->c, nodes_list, MAX_SENT_NODES);; | ||
1196 | unsigned int i; | ||
1197 | |||
1198 | for (i = 0; i < num_nodes; ++i) { | ||
1199 | onion_add_path_node(onion_c, nodes_list[i].ip_port, nodes_list[i].client_id); | ||
1200 | } | ||
1201 | } | ||
1202 | |||
1191 | #define ANNOUNCE_FRIEND (ONION_NODE_PING_INTERVAL * 6) | 1203 | #define ANNOUNCE_FRIEND (ONION_NODE_PING_INTERVAL * 6) |
1192 | #define ANNOUNCE_FRIEND_BEGINNING 3 | 1204 | #define ANNOUNCE_FRIEND_BEGINNING 3 |
1193 | #define FRIEND_ONION_NODE_TIMEOUT (ONION_NODE_TIMEOUT * 6) | 1205 | #define FRIEND_ONION_NODE_TIMEOUT (ONION_NODE_TIMEOUT * 6) |
@@ -1345,6 +1357,8 @@ void do_onion_client(Onion_Client *onion_c) | |||
1345 | for (i = 0; i < onion_c->num_friends; ++i) { | 1357 | for (i = 0; i < onion_c->num_friends; ++i) { |
1346 | do_friend(onion_c, i); | 1358 | do_friend(onion_c, i); |
1347 | } | 1359 | } |
1360 | } else { | ||
1361 | populate_path_nodes_tcp(onion_c); | ||
1348 | } | 1362 | } |
1349 | 1363 | ||
1350 | onion_c->last_run = unix_time(); | 1364 | onion_c->last_run = unix_time(); |