stunnel/stunnel-listenqueue-option.patch

55 lines
1.9 KiB
Diff

---
src/options.c | 18 ++++++++++++++++++
src/prototypes.h | 1 +
src/stunnel.c | 2 +-
3 files changed, 20 insertions(+), 1 deletion(-)
--- src/options.c
+++ src/options.c 2017-04-06 08:40:50.927511225 +0000
@@ -1881,6 +1881,24 @@ NOEXPORT char *parse_service_option(CMD
break;
}
+ /* listenqueue option */
+ switch(cmd) {
+ case CMD_BEGIN:
+ 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:
+ s_log(LOG_NOTICE, "%-15s = %d", "listenqueue", SOMAXCONN);
+ break;
+ case CMD_HELP:
+ s_log(LOG_NOTICE, "%-15s = defines the maximum length the queue of pending connections may grow to (max SOMAXCONN)", "listenqueue");
+ break;
+ }
+
#ifndef OPENSSL_NO_OCSP
/* OCSP */
--- src/prototypes.h
+++ src/prototypes.h 2017-04-06 08:40:50.927511225 +0000
@@ -252,6 +252,7 @@ typedef struct service_options_struct {
int timeout_close; /* maximum close_notify time */
int timeout_connect; /* maximum connect() time */
int timeout_idle; /* maximum idle connection time */
+ int listenqueue; /* Listen backlog */
enum {FAILOVER_RR, FAILOVER_PRIO} failover; /* failover strategy */
char *username;
--- src/stunnel.c
+++ src/stunnel.c 2017-04-06 08:40:50.927511225 +0000
@@ -476,7 +476,7 @@ int bind_ports(void) {
str_free(local_address);
return 1;
}
- if(listen(opt->fd, SOMAXCONN)) {
+ if(listen(opt->fd, opt->listenqueue)) {
sockerror("listen");
closesocket(opt->fd);
opt->fd=INVALID_SOCKET;