mirror of
https://github.com/yrutschle/sslh.git
synced 2026-10-22 02:01:20 +03:00
sslh-fork: decrement num_connections when fork() fails
num_connections was incremented before fork(), but the fork-failure path only logged and closed the socket - no child exists to decrement the counter, so each failed fork permanently inflates it. Under fork failure conditions (process limits, memory pressure) the listener eventually reports max_connections reached and refuses all connections until restart.
This commit is contained in:
1 parent
91736dbd17
commit
b9d9f9112f
1 file changed
+1
@@ -264,6 +264,7 @@ void tcp_listener(struct listen_endpoint* endpoint, int num_endpoints, int activ
|
||||
|
||||
switch(fork()) {
|
||||
case -1: print_message(msg_system_error, "fork failed: err %d: %s\n", errno, strerror(errno));
|
||||
self->num_connections--; /* no child will reap it */
|
||||
break;
|
||||
|
||||
case 0: /* In child process */
|
||||
|
||||
Reference in new issue
Block a user