summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2009-05-17 21:32:53 +0200
committerFlorian Westphal <fw@strlen.de>2009-05-17 21:32:53 +0200
commit9b1c47220fafeacda1e83b4732e1c8574062aac6 (patch)
treedda988d751096592b9966b62925f2dd9effeb96c /src
parent8e2c5816eec58a5de63399a54773dda6a5729c36 (diff)
downloadngircd-9b1c47220fafeacda1e83b4732e1c8574062aac6.tar.gz
ngircd-9b1c47220fafeacda1e83b4732e1c8574062aac6.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/ngircd/conn.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/ngircd/conn.c b/src/ngircd/conn.c
index 4c03877a..77a2bc19 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 );