1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-22 21:23:01 +01:00

auto-connect errors verbose

This commit is contained in:
Jfreegman 2013-08-12 22:04:07 -04:00
parent ab11469d37
commit 0c6204ce82

10
main.c
View File

@ -252,10 +252,15 @@ static void init_windows()
static void do_tox()
{
static int conn_try = 0;
static int conn_err = 0;
static bool dht_on = false;
if (!dht_on && !DHT_isconnected() && !(conn_try++ % 100)) {
init_connection();
wprintw(prompt->window, "\nEstablishing connection...\n");
if (!conn_err) {
conn_err = init_connection();
wprintw(prompt->window, "\nEstablishing connection...\n");
if (conn_err)
wprintw(prompt->window, "\nAuto-connect failed with error code %d\n", conn_err);
}
}
else if (!dht_on && DHT_isconnected()) {
dht_on = true;
@ -264,7 +269,6 @@ static void do_tox()
else if (dht_on && !DHT_isconnected()) {
dht_on = false;
wprintw(prompt->window, "\nDHT disconnected. Attempting to reconnect.\n");
init_connection();
}
doMessenger(m);
}