diff options
author | irungentoo <irungentoo@gmail.com> | 2015-04-16 20:39:09 -0400 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2015-04-16 20:39:09 -0400 |
commit | 92a708578f9aa4c2cff2d3a2de08e28ee61cda1b (patch) | |
tree | 5546bab3a0102f02ed877fb0aa93b9e00f292bf7 /toxcore/TCP_connection.c | |
parent | de8956267c06444443e43980a53e7ded49ee4d3a (diff) |
Properly share connected relays and connect to the friend correctly
with them.
Diffstat (limited to 'toxcore/TCP_connection.c')
-rw-r--r-- | toxcore/TCP_connection.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/toxcore/TCP_connection.c b/toxcore/TCP_connection.c index 49a213a7..ab18daac 100644 --- a/toxcore/TCP_connection.c +++ b/toxcore/TCP_connection.c | |||
@@ -901,10 +901,10 @@ int add_tcp_relay_connection(TCP_Connections *tcp_c, int connections_number, IP_ | |||
901 | */ | 901 | */ |
902 | unsigned int tcp_copy_connected_relays(TCP_Connections *tcp_c, Node_format *tcp_relays, uint16_t max_num) | 902 | unsigned int tcp_copy_connected_relays(TCP_Connections *tcp_c, Node_format *tcp_relays, uint16_t max_num) |
903 | { | 903 | { |
904 | unsigned int i, copied = 0; | 904 | unsigned int i, copied = 0, r = rand(); |
905 | 905 | ||
906 | for (i = 0; (i < tcp_c->tcp_connections_length) && (copied < max_num); ++i) { | 906 | for (i = 0; (i < tcp_c->tcp_connections_length) && (copied < max_num); ++i) { |
907 | TCP_con *tcp_con = get_tcp_connection(tcp_c, i); | 907 | TCP_con *tcp_con = get_tcp_connection(tcp_c, (i + r) % tcp_c->tcp_connections_length); |
908 | 908 | ||
909 | if (!tcp_con) { | 909 | if (!tcp_con) { |
910 | continue; | 910 | continue; |