From 92a708578f9aa4c2cff2d3a2de08e28ee61cda1b Mon Sep 17 00:00:00 2001 From: irungentoo Date: Thu, 16 Apr 2015 20:39:09 -0400 Subject: Properly share connected relays and connect to the friend correctly with them. --- toxcore/TCP_connection.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'toxcore/TCP_connection.c') 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_ */ unsigned int tcp_copy_connected_relays(TCP_Connections *tcp_c, Node_format *tcp_relays, uint16_t max_num) { - unsigned int i, copied = 0; + unsigned int i, copied = 0, r = rand(); for (i = 0; (i < tcp_c->tcp_connections_length) && (copied < max_num); ++i) { - TCP_con *tcp_con = get_tcp_connection(tcp_c, i); + TCP_con *tcp_con = get_tcp_connection(tcp_c, (i + r) % tcp_c->tcp_connections_length); if (!tcp_con) { continue; -- cgit v1.2.3