From af473b3b6ea9d1640667c0006d8bfad5af19b3f8 Mon Sep 17 00:00:00 2001 From: Thomas Mannay Date: Fri, 16 Dec 2016 15:28:18 +0000 Subject: [PATCH] Fix error in ping timeout --- tubes.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tubes.c b/tubes.c index 3ede285..40438de 100644 --- a/tubes.c +++ b/tubes.c @@ -23,7 +23,7 @@ static SSL *ssl; static char *host = "chat.freenode.net"; static char port[6] = "6667"; static short use_ssl = 0; -static unsigned int last_response; +static unsigned int last_response = time(NULL); static int tube(char *direction) @@ -149,7 +149,7 @@ main(int argc, char **argv) syslog(LOG_ERR, strerror(errno)); status = 1; break; - } else if (r == 0 && last_response - time(NULL) >= PING_TIMEOUT) { + } else if (r == 0 && time(NULL) - last_response >= PING_TIMEOUT) { syslog(LOG_ERR, "ping timeout"); status = 1; break;