From 0ac4f1fcb33e660efcd57d546e88630168d4814b Mon Sep 17 00:00:00 2001 From: Jfreegman Date: Mon, 12 Aug 2013 22:04:07 -0400 Subject: auto-connect errors verbose --- testing/toxic/main.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/testing/toxic/main.c b/testing/toxic/main.c index c5c881fd..63c4db25 100644 --- a/testing/toxic/main.c +++ b/testing/toxic/main.c @@ -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); } -- cgit v1.2.3