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:
Stefan Meinecke authored and Yves Rutschle committed 2026-10-18 22:26:58 +02:00
1 parent 91736dbd17
commit b9d9f9112f
1 file changed
+1
+1
View File
@@ -264,6 +264,7 @@ void tcp_listener(struct listen_endpoint* endpoint, int num_endpoints, int activ
switch(fork()) { switch(fork()) {
case -1: print_message(msg_system_error, "fork failed: err %d: %s\n", errno, strerror(errno)); 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; break;
case 0: /* In child process */ case 0: /* In child process */