mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
tox_isconnected() now works on TCP only.
This commit is contained in:
parent
1298932deb
commit
5376d40f54
|
@ -1274,3 +1274,19 @@ void kill_onion_client(Onion_Client *onion_c)
|
||||||
memset(onion_c, 0, sizeof(Onion_Client));
|
memset(onion_c, 0, sizeof(Onion_Client));
|
||||||
free(onion_c);
|
free(onion_c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* return 0 if we are not connected to the network.
|
||||||
|
* return 1 if we are.
|
||||||
|
*/
|
||||||
|
int onion_isconnected(const Onion_Client *onion_c)
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
|
for (i = 0; i < MAX_ONION_CLIENTS; ++i) {
|
||||||
|
if (!is_timeout(onion_c->clients_announce_list[i].timestamp, ONION_NODE_TIMEOUT))
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
|
@ -236,4 +236,10 @@ Onion_Client *new_onion_client(Net_Crypto *c);
|
||||||
|
|
||||||
void kill_onion_client(Onion_Client *onion_c);
|
void kill_onion_client(Onion_Client *onion_c);
|
||||||
|
|
||||||
|
|
||||||
|
/* return 0 if we are not connected to the network.
|
||||||
|
* return 1 if we are.
|
||||||
|
*/
|
||||||
|
int onion_isconnected(const Onion_Client *onion_c);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -796,7 +796,7 @@ int tox_bootstrap_from_address(Tox *tox, const char *address,
|
||||||
int tox_isconnected(const Tox *tox)
|
int tox_isconnected(const Tox *tox)
|
||||||
{
|
{
|
||||||
const Messenger *m = tox;
|
const Messenger *m = tox;
|
||||||
return DHT_isconnected(m->dht);
|
return DHT_isconnected(m->dht) || onion_isconnected(m->onion_c);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return the time in milliseconds before tox_do() should be called again
|
/* Return the time in milliseconds before tox_do() should be called again
|
||||||
|
|
Loading…
Reference in New Issue
Block a user