diff options
author | Jfreegman <Jfreegman@gmail.com> | 2013-08-12 22:04:07 -0400 |
---|---|---|
committer | Jfreegman <Jfreegman@gmail.com> | 2013-08-12 22:04:07 -0400 |
commit | 0ac4f1fcb33e660efcd57d546e88630168d4814b (patch) | |
tree | 11d612f7f1f0aa99ea497c5a9ed5c3ddfcdbada6 | |
parent | 92029baff1f4e30f610de866d1efb3921240e3bb (diff) |
auto-connect errors verbose
-rw-r--r-- | testing/toxic/main.c | 10 |
1 files 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() | |||
252 | static void do_tox() | 252 | static void do_tox() |
253 | { | 253 | { |
254 | static int conn_try = 0; | 254 | static int conn_try = 0; |
255 | static int conn_err = 0; | ||
255 | static bool dht_on = false; | 256 | static bool dht_on = false; |
256 | if (!dht_on && !DHT_isconnected() && !(conn_try++ % 100)) { | 257 | if (!dht_on && !DHT_isconnected() && !(conn_try++ % 100)) { |
257 | init_connection(); | 258 | if (!conn_err) { |
258 | wprintw(prompt->window, "\nEstablishing connection...\n"); | 259 | conn_err = init_connection(); |
260 | wprintw(prompt->window, "\nEstablishing connection...\n"); | ||
261 | if (conn_err) | ||
262 | wprintw(prompt->window, "\nAuto-connect failed with error code %d\n", conn_err); | ||
263 | } | ||
259 | } | 264 | } |
260 | else if (!dht_on && DHT_isconnected()) { | 265 | else if (!dht_on && DHT_isconnected()) { |
261 | dht_on = true; | 266 | dht_on = true; |
@@ -264,7 +269,6 @@ static void do_tox() | |||
264 | else if (dht_on && !DHT_isconnected()) { | 269 | else if (dht_on && !DHT_isconnected()) { |
265 | dht_on = false; | 270 | dht_on = false; |
266 | wprintw(prompt->window, "\nDHT disconnected. Attempting to reconnect.\n"); | 271 | wprintw(prompt->window, "\nDHT disconnected. Attempting to reconnect.\n"); |
267 | init_connection(); | ||
268 | } | 272 | } |
269 | doMessenger(m); | 273 | doMessenger(m); |
270 | } | 274 | } |