]> arthur.barton.de Git - ngircd-alex.git/commitdiff
conn.c: fix NumConnections imbalance
authorFlorian Westphal <fw@strlen.de>
Sun, 17 May 2009 19:32:53 +0000 (21:32 +0200)
committerFlorian Westphal <fw@strlen.de>
Sun, 17 May 2009 19:32:53 +0000 (21:32 +0200)
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

index 4c03877a8f5e843f21211a990e6b61f3a187899c..77a2bc19d486262bccd5586415f3569b3220f86e 100644 (file)
@@ -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 );