This patch lets ngIRCd count outgoing connections as well as incoming
connections (up to now only outgoing connections have been counted). This
change is required because the Conn_Close() function doesn't know whether
it closes an outgoing connection or not and therefore would decrement the
counter below zero when an outgoing connection existed -- which would
trigger an assert() call ...
Please note that this patch changes the (so far undocumented but now fixed)
behaviour of the "MaxConnections" configuration option to account the sum
of the in- and outbound connections!
;ConnectIPv6 = yes
;ConnectIPv4 = yes
;ConnectIPv6 = yes
;ConnectIPv4 = yes
- # Maximum number of simultaneous connection the server is allowed
- # to accept (0: unlimited):
+ # Maximum number of simultaneous in- and outbound connections the
+ # server is allowed to accept (0: unlimited):
;MaxConnections = 0
# Maximum number of simultaneous connections from a single IP address
;MaxConnections = 0
# Maximum number of simultaneous connections from a single IP address
Default: Yes.
.TP
\fBMaxConnections\fR
Default: Yes.
.TP
\fBMaxConnections\fR
-Maximum number of simultaneous connection the server is allowed to accept
-(0: unlimited). Default: 0.
+Maximum number of simultaneous in- and outbound connections the server is
+allowed to accept (0: unlimited). Default: 0.
.TP
\fBMaxConnectionsIP\fR
Maximum number of simultaneous connections from a single IP address that
.TP
\fBMaxConnectionsIP\fR
Maximum number of simultaneous connections from a single IP address that
(void) irrelevant;
if (New_Connection( sock ) >= 0)
NumConnections++;
(void) irrelevant;
if (New_Connection( sock ) >= 0)
NumConnections++;
+ LogDebug("Total number of connections now %ld.", NumConnections);
return;
NumConnections++;
return;
NumConnections++;
+ LogDebug("Total number of connections now %ld.", NumConnections);
io_event_setcb(My_Connections[fd].sock, cb_clientserver_ssl);
}
#endif
io_event_setcb(My_Connections[fd].sock, cb_clientserver_ssl);
}
#endif
assert(NumConnections > 0);
if (NumConnections)
NumConnections--;
assert(NumConnections > 0);
if (NumConnections)
NumConnections--;
- LogDebug("Shutdown of connection %d completed", Idx );
+ LogDebug("Shutdown of connection %d completed, %ld connection%s left.",
+ Idx, NumConnections, NumConnections != 1 ? "s" : "");
Conf_Server[Server].conn_id = NONE;
}
#endif
Conf_Server[Server].conn_id = NONE;
}
#endif
- LogDebug("Registered new connection %d on socket %d.",
- new_sock, My_Connections[new_sock].sock );
+ NumConnections++;
+ LogDebug("Registered new connection %d on socket %d (%ld in total).",
+ new_sock, My_Connections[new_sock].sock, NumConnections);
Conn_OPTION_ADD( &My_Connections[new_sock], CONN_ISCONNECTING );
} /* New_Server */
Conn_OPTION_ADD( &My_Connections[new_sock], CONN_ISCONNECTING );
} /* New_Server */