stunnel/stunnel-listenqueue-option.patch

57 lines
1.9 KiB
Diff
Raw Normal View History

Index: src/options.c
===================================================================
--- src/options.c.orig
+++ src/options.c
@@ -1535,6 +1535,25 @@ static char *parse_service_option(CMD cm
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:
+ 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 onnections may grow to (max SOMAXCONN)", "listenqueue");
+ break;
+ }
+
+
if(cmd==CMD_EXEC)
return option_not_found;
return NULL; /* OK */
Index: src/prototypes.h
===================================================================
--- src/prototypes.h.orig
+++ src/prototypes.h
@@ -170,6 +170,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 */
/* service-specific data for protocol.c */
Index: src/stunnel.c
===================================================================
--- src/stunnel.c.orig
+++ src/stunnel.c
@@ -363,7 +363,7 @@
str_free(local_address);
return 1;
}
- if(listen(opt->fd, SOMAXCONN)) {
+ if(listen(opt->fd, opt->listenqueue)) {
sockerror("listen");
closesocket(opt->fd);
str_free(local_address);