aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2017-08-19 12:36:48 +0200
committerNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2017-08-19 12:36:48 +0200
commit8314e55911cee7c64a94d7e7092b69b51b805c93 (patch)
tree3bdf2ec907893f31c82e9fb02f9d01de5553e2cf
parent64275e09a21aa78076c1aaefc015e96c2864847b (diff)
downloadirc-8314e55911cee7c64a94d7e7092b69b51b805c93.zip
irc-8314e55911cee7c64a94d7e7092b69b51b805c93.tar.bz2
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.
-rw-r--r--src/main.c16
1 files 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);