]> granicus.if.org Git - ngircd/commitdiff
New function Conn_UpdatePing() to update the "ping timestamp"
authorAlexander Barton <alex@barton.de>
Tue, 24 Jan 2012 01:44:57 +0000 (02:44 +0100)
committerAlexander Barton <alex@barton.de>
Tue, 24 Jan 2012 01:44:57 +0000 (02:44 +0100)
src/ngircd/conn-func.c
src/ngircd/conn-func.h
src/ngircd/conn.c

index 23c2075895c1d3157402ed1d80d9cfc967f46b2f..e81a79e961a1c165b4bf4851a8f594f6d4af74ee 100644 (file)
@@ -43,6 +43,17 @@ Conn_UpdateIdle(CONN_ID Idx)
        My_Connections[Idx].lastprivmsg = time(NULL);
 }
 
+/**
+ * Update "ping timestamp", the time of the last outgoing PING request.
+ *
+ * @param Idx Connection index.
+ */
+GLOBAL void
+Conn_UpdatePing(CONN_ID Idx)
+{
+       assert(Idx > NONE);
+       My_Connections[Idx].lastping = time(NULL);
+}
 
 /*
  * Get signon time of a connection.
index 729860e45a8b7161eba5f55bc5c9607721b75222..21bbcdb0c9e2de517dc3b30f5dceb12152d0a494 100644 (file)
@@ -29,7 +29,9 @@
 #endif
 
 
-GLOBAL void Conn_UpdateIdle PARAMS(( CONN_ID Idx ));
+GLOBAL void Conn_UpdateIdle PARAMS((CONN_ID Idx));
+GLOBAL void Conn_UpdatePing PARAMS((CONN_ID Idx));
+
 GLOBAL time_t Conn_GetSignon PARAMS((CONN_ID Idx));
 GLOBAL time_t Conn_GetIdle PARAMS(( CONN_ID Idx ));
 GLOBAL time_t Conn_LastPing PARAMS(( CONN_ID Idx ));
index 35d740051f8822a4d8976154ae399e83ceb2a3b5..f743d1f81b2331a81a3cbcc6bbbf9ca99b645b58 100644 (file)
@@ -1850,7 +1850,7 @@ Check_Connections(void)
                                   time(NULL) - Conf_PingTimeout) {
                                /* We need to send a PING ... */
                                LogDebug("Connection %d: sending PING ...", i);
-                               My_Connections[i].lastping = time(NULL);
+                               Conn_UpdatePing(i);
                                Conn_WriteStr(i, "PING :%s",
                                              Client_ID(Client_ThisServer()));
                        }