File stunnel-listenqueue-option.patch of Package stunnel.18716

diff -ruN a/src/options.c b/src/options.c
--- a/src/options.c	2018-01-23 19:23:27.813960936 -0500
+++ b/src/options.c	2018-01-23 19:28:05.463119114 -0500
@@ -2997,8 +2997,6 @@
     switch(cmd) {
     case CMD_BEGIN:
         break;
-    case CMD_EXEC:
-        return option_not_found;
     case CMD_END:
         if(new_service_options.next) { /* daemon mode checks */
             if(endpoints!=2)
@@ -3019,6 +3017,25 @@
         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;
+    }
+
     return NULL; /* OK */
 }
 
diff -ruN a/src/prototypes.h b/src/prototypes.h
--- a/src/prototypes.h	2018-01-23 19:23:27.813960936 -0500
+++ b/src/prototypes.h	2018-01-23 19:28:45.854124040 -0500
@@ -251,6 +251,7 @@
     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 */
     unsigned seq;              /* sequential number for round-robin failover */
     char *username;
diff -ruN a/src/stunnel.c b/src/stunnel.c
--- a/src/stunnel.c	2018-01-23 19:23:27.813960936 -0500
+++ b/src/stunnel.c	2018-01-23 19:29:26.365126071 -0500
@@ -526,7 +526,7 @@
             closesocket(fd);
             return INVALID_SOCKET;
         }
-        if(listen(fd, SOMAXCONN)) {
+        if(listen(fd, opt->listenqueue)) {
             sockerror("listen");
             str_free(local_address);
             closesocket(fd);
openSUSE Build Service is sponsored by