X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fngircd%2Fconn.c;h=7e7f6e65181bd53032c78eb1c719952a84e90b40;hb=56ed5c90ad02fb10cdbd7767a9dd85b2e06cdb19;hp=c304fdb574ffc497552f76fec4c531bb5c359abe;hpb=02850008f4a4e8fff5799157d21ee7924345b3e1;p=ngircd-alex.git diff --git a/src/ngircd/conn.c b/src/ngircd/conn.c index c304fdb5..7e7f6e65 100644 --- a/src/ngircd/conn.c +++ b/src/ngircd/conn.c @@ -591,7 +591,7 @@ set_v6_only(int af, int sock) /** * Initialize new listening port. * - * @param listen_addr Local address to bind the socet to (can be 0.0.0.0). + * @param listen_addr Local address to bind the socket to (can be 0.0.0.0). * @param Port Port number on which the new socket should be listening. * @returns file descriptor of the socket or -1 on failure. */ @@ -875,7 +875,7 @@ va_dcl #ifdef SNIFFER if (NGIRCd_Sniffer) - Log(LOG_DEBUG, " -> connection %d: '%s'.", Idx, buffer); + LogDebug("-> connection %d: '%s'.", Idx, buffer); #endif len = strlcat( buffer, "\r\n", sizeof( buffer )); @@ -1454,7 +1454,7 @@ New_Connection(int Sock, UNUSED bool IsSSL) Account_Connection(); #ifdef SSL_SUPPORT - /* Delay connection initalization until SSL handshake is finished */ + /* Delay connection initialization until SSL handshake is finished */ if (!IsSSL) #endif Conn_StartLogin(new_sock); @@ -1866,6 +1866,9 @@ Check_Connections(void) CLIENT *c; CONN_ID i; char msg[64]; + time_t time_now; + + time_now = time(NULL); for (i = 0; i < Pool_Size; i++) { if (My_Connections[i].sock < 0) @@ -1880,7 +1883,7 @@ Check_Connections(void) My_Connections[i].lastdata) { /* We already sent a ping */ if (My_Connections[i].lastping < - time(NULL) - Conf_PongTimeout) { + time_now - Conf_PongTimeout) { /* Timeout */ snprintf(msg, sizeof(msg), "Ping timeout: %d seconds", @@ -1889,10 +1892,10 @@ Check_Connections(void) Conn_Close(i, NULL, msg, true); } } else if (My_Connections[i].lastdata < - time(NULL) - Conf_PingTimeout) { + time_now - Conf_PingTimeout) { /* We need to send a PING ... */ LogDebug("Connection %d: sending PING ...", i); - Conn_UpdatePing(i); + Conn_UpdatePing(i, time_now); Conn_WriteStr(i, "PING :%s", Client_ID(Client_ThisServer())); } @@ -1903,7 +1906,7 @@ Check_Connections(void) * still not registered. */ if (My_Connections[i].lastdata < - time(NULL) - Conf_PongTimeout) { + time_now - Conf_PongTimeout) { LogDebug ("Unregistered connection %d timed out ...", i); @@ -2695,11 +2698,11 @@ Conn_DebugDump(void) { int i; - Log(LOG_DEBUG, "Connection status:"); + LogDebug("Connection status:"); for (i = 0; i < Pool_Size; i++) { if (My_Connections[i].sock == NONE) continue; - Log(LOG_DEBUG, + LogDebug( " - %d: host=%s, lastdata=%ld, lastping=%ld, delaytime=%ld, flag=%d, options=%d, bps=%d, client=%s", My_Connections[i].sock, My_Connections[i].host, My_Connections[i].lastdata, My_Connections[i].lastping,