Florian Westphal : conn.c: fix NumConnections imbalance
Module: ngircd.git Branch: master Commit: 9b1c47220fafeacda1e83b4732e1c8574062aac6 URL: http://ngircd.barton.de/cgi-bin/gitweb.cgi?p=ngircd.git&a=commit;h=9b1c47220... Author: Florian Westphal <fw@strlen.de> Date: Sun May 17 21:32:53 2009 +0200 conn.c: fix NumConnections imbalance New_Server() can call Conn_Close() in its error paths, but that function decrements the number of current active connections. Thus we need to increment it earlier. --- src/ngircd/conn.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/src/ngircd/conn.c b/src/ngircd/conn.c index 4c03877..77a2bc1 100644 --- a/src/ngircd/conn.c +++ b/src/ngircd/conn.c @@ -1696,6 +1696,8 @@ New_Server( int Server , ng_ipaddr_t *dest) return; } + /* Conn_Close() decrements this counter again */ + NumConnections++; Client_SetIntroducer( c, c ); Client_SetToken( c, TOKEN_OUTBOUND ); @@ -1725,7 +1727,6 @@ New_Server( int Server , ng_ipaddr_t *dest) return; } #endif - 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 );
Teilnehmer (1)
-
fw@arthur.barton.de