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.
This commit is contained in:
parent
8e2c5816ee
commit
9b1c47220f
@ -1696,6 +1696,8 @@ New_Server( int Server , ng_ipaddr_t *dest)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Conn_Close() decrements this counter again */
|
||||||
|
NumConnections++;
|
||||||
Client_SetIntroducer( c, c );
|
Client_SetIntroducer( c, c );
|
||||||
Client_SetToken( c, TOKEN_OUTBOUND );
|
Client_SetToken( c, TOKEN_OUTBOUND );
|
||||||
|
|
||||||
@ -1725,7 +1727,6 @@ New_Server( int Server , ng_ipaddr_t *dest)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
NumConnections++;
|
|
||||||
LogDebug("Registered new connection %d on socket %d (%ld in total).",
|
LogDebug("Registered new connection %d on socket %d (%ld in total).",
|
||||||
new_sock, My_Connections[new_sock].sock, NumConnections);
|
new_sock, My_Connections[new_sock].sock, NumConnections);
|
||||||
Conn_OPTION_ADD( &My_Connections[new_sock], CONN_ISCONNECTING );
|
Conn_OPTION_ADD( &My_Connections[new_sock], CONN_ISCONNECTING );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user