Fix bug causing API to report wrong self connection status

This commit is contained in:
jfreegman 2021-11-09 11:39:56 -05:00
parent 99d873b985
commit c0a0a8204c
No known key found for this signature in database
GPG Key ID: 3627F3144076AE63

View File

@ -1834,15 +1834,12 @@ void do_onion_client(Onion_Client *onion_c)
}
}
bool udp_connected = dht_non_lan_connected(onion_c->dht);
onion_c->udp_connected = dht_non_lan_connected(onion_c->dht);
if (mono_time_is_timeout(onion_c->mono_time, onion_c->first_run, ONION_CONNECTION_SECONDS * 2)) {
set_tcp_onion_status(nc_get_tcp_c(onion_c->c), !udp_connected);
set_tcp_onion_status(nc_get_tcp_c(onion_c->c), !onion_c->udp_connected);
}
onion_c->udp_connected = udp_connected
|| get_random_tcp_onion_conn_number(nc_get_tcp_c(onion_c->c)) == -1; /* Check if connected to any TCP relays. */
if (onion_connection_status(onion_c)) {
for (unsigned i = 0; i < onion_c->num_friends; ++i) {
do_friend(onion_c, i);