--- stunnel-4.15/src/options.c~ 2011-03-15 15:53:36.000000000 +0100 +++ stunnel-4.15/src/options.c 2011-03-15 15:53:36.000000000 +0100 @@ -758,6 +785,24 @@ break; } + /* listenqueue */ + switch(cmd) { + case CMD_INIT: + section->listenqueue=SOMAXCONN; + break; + case CMD_EXEC: + if(strcasecmp(opt, "listenqueue")) + break; + section->listenqueue=atoi(arg); + return (section->listenqueue?NULL:"Bad verify level"); + case CMD_DEFAULT: + log_raw("%-15s = %d", "listenqueue", SOMAXCONN); + break; + case CMD_HELP: + log_raw("%-15s = defines the maximum length the queue of pending connections may grow to", "listenqueue"); + break; + } + /* local */ switch(cmd) { case CMD_INIT: --- stunnel-4.15/src/prototypes.h~ 2011-03-15 15:54:06.000000000 +0100 +++ stunnel-4.15/src/prototypes.h 2011-03-15 15:54:06.000000000 +0100 @@ -171,6 +171,7 @@ int timeout_close; /* Maximum close_notify time */ int timeout_connect; /* Maximum connect() time */ int timeout_idle; /* Maximum idle connection time */ + int listenqueue; /* Listen baklog */ /* protocol name for protocol.c */ char *protocol; --- stunnel-4.15/src/stunnel.c~ 2011-03-15 15:54:53.000000000 +0100 +++ stunnel-4.15/src/stunnel.c 2011-03-15 15:54:53.000000000 +0100 @@ -140,7 +140,7 @@ exit(1); } s_log(LOG_DEBUG, "%s bound to %s", opt->servname, opt->local_address); - if(listen(opt->fd, 5)) { + if(listen(opt->fd, opt->listenqueue)) { sockerror("listen"); exit(1); }