From 8314e55911cee7c64a94d7e7092b69b51b805c93 Mon Sep 17 00:00:00 2001 From: Nathanael Sensfelder Date: Sat, 19 Aug 2017 12:36:48 +0200 Subject: Adds timeout to connection test. I didn't check if libircclient could detect the lack of connection during the test, but since implementing that timeout is way easier than expected (and prevents spamming connection tests), I simply added it. --- src/main.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/main.c b/src/main.c index becd6a3..a4254bd 100644 --- a/src/main.c +++ b/src/main.c @@ -169,9 +169,21 @@ static int event_handling_loop timeouts += 1; /* 1200 timeouts => 5min */ - if ((timeouts >= 1200) && (JH_irc_test_connection(irc) != 0)) + if ((timeouts == 1200) && (JH_irc_test_connection(irc) != 0)) { - JH_S_ERROR(stderr, "Timed out."); + JH_S_ERROR(stderr, "Timed out due to fail connection test."); + + JH_irc_finalize(irc); + + return -1; + } + else if (timeouts >= 1500) + { + JH_S_ERROR + ( + stderr, + "Timed out due to lack of response to connection test." + ); JH_irc_finalize(irc); -- cgit v1.2.3-70-g09d2