From c259250abb86a01ae7e3fc906380417427f38ca1 Mon Sep 17 00:00:00 2001 From: irungentoo Date: Fri, 3 Jul 2015 21:52:53 -0400 Subject: Fixed Tox reporting itself as being connected with TCP when using UDP only on LAN. --- toxcore/onion_client.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'toxcore') diff --git a/toxcore/onion_client.c b/toxcore/onion_client.c index 4f049fbc..8609c6b6 100644 --- a/toxcore/onion_client.c +++ b/toxcore/onion_client.c @@ -1452,12 +1452,15 @@ void do_onion_client(Onion_Client *onion_c) } } - onion_c->UDP_connected = DHT_non_lan_connected(onion_c->dht); + _Bool UDP_connected = DHT_non_lan_connected(onion_c->dht); if (is_timeout(onion_c->first_run, ONION_CONNECTION_SECONDS)) { - set_tcp_onion_status(onion_c->c->tcp_c, !onion_c->UDP_connected); + set_tcp_onion_status(onion_c->c->tcp_c, !UDP_connected); } + onion_c->UDP_connected = UDP_connected + || get_random_tcp_onion_conn_number(onion_c->c->tcp_c) == -1; /* Check if connected to any TCP relays. */ + if (onion_connection_status(onion_c)) { for (i = 0; i < onion_c->num_friends; ++i) { do_friend(onion_c, i); -- cgit v1.2.3