void do_onion_client(Onion_Client *onion_c) { unsigned int i; if (onion_c->last_run == unix_time()) return; for (i = 0; i < NODE_POPULATE_TIMES; ++i) populate_path_nodes(onion_c); do_announce(onion_c); if (onion_isconnected(onion_c)) { for (i = 0; i < onion_c->num_friends; ++i) { do_friend(onion_c, i); } } onion_c->last_run = unix_time(); }
/* return 0 if we are not connected to the DHT. * return 1 if we are. */ int tox_isconnected(const Tox *tox) { const Messenger *m = tox; return onion_isconnected(m->onion_c); }