Fixed Tox reporting itself as being connected with TCP when using UDP only on LAN.

This commit is contained in:
irungentoo 2015-07-03 21:52:53 -04:00
parent 750201c901
commit c259250abb
No known key found for this signature in database
GPG Key ID: 10349DC9BED89E98
2 changed files with 7 additions and 2 deletions

View File

@ -281,6 +281,8 @@ void tox_connection_status(Tox *tox, TOX_CONNECTION connection_status, void *use
if (connected_t1 && !connection_status)
ck_abort_msg("Tox went offline");
ck_assert_msg(connection_status == TOX_CONNECTION_UDP, "wrong status %u", connection_status);
connected_t1 = connection_status;
}

View File

@ -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);