summaryrefslogtreecommitdiff
path: root/testing/toxic/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'testing/toxic/main.c')
-rw-r--r--testing/toxic/main.c10
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()
252static void do_tox() 252static 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}