summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlexander Barton <alex@barton.de>2020-05-25 23:30:07 +0200
committerAlexander Barton <alex@barton.de>2020-05-25 23:30:07 +0200
commit430bb223765281487e5c6d415a8efb91e2bf3320 (patch)
tree4027584e46b7a355ad55f2ec36e168ca08372dd9
parentdc6807338e240d8093f43337dab7bfe488c35c4a (diff)
downloadngircd-430bb223765281487e5c6d415a8efb91e2bf3320.tar.gz
ngircd-430bb223765281487e5c6d415a8efb91e2bf3320.zip
Enhance debug logging for PONG commands
Distinguish between expected and unexpected PONG commands.
-rw-r--r--src/ngircd/irc-login.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/ngircd/irc-login.c b/src/ngircd/irc-login.c
index f682e216..368a03d4 100644
--- a/src/ngircd/irc-login.c
+++ b/src/ngircd/irc-login.c
@@ -877,9 +877,17 @@ IRC_PONG(CLIENT *Client, REQUEST *Req)
 		    (long)(time(NULL) - Conn_GetSignon(conn)),
 		    time(NULL) - Conn_GetSignon(conn) == 1 ? "" : "s",
 		    Client_UserCount(), Channel_CountVisible(NULL));
-	} else
-		LogDebug("Connection %d: received PONG. Lag: %ld seconds.",
-			 conn, (long)(time(NULL) - Conn_LastPing(conn)));
+	}
+#ifdef DEBUG
+	else {
+		if (Conn_LastPing(conn) > 1)
+			LogDebug("Connection %d: received PONG. Lag: %ld seconds.",
+				 conn, (long)(time(NULL) - Conn_LastPing(conn)));
+		else
+			LogDebug("Got unexpected PONG on connection %d. Ignored.",
+				 conn);
+	}
+#endif
 
 	/* We got a PONG, so signal that none is pending on this connection. */
 	Conn_UpdatePing(conn, 1);