/**
* 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.
*/
#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 ));
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);
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)
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",
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()));
}
* still not registered. */
if (My_Connections[i].lastdata <
- time(NULL) - Conf_PongTimeout) {
+ time_now - Conf_PongTimeout) {
LogDebug
("Unregistered connection %d timed out ...",
i);
{
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,