From: Robert McMahon <rjmcma...@rjmcmahon.com>
Subject: [PATCH] increase listen backlog limit to much larger value
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=930386
Bug-Ubuntu: https://bugs.launchpad.net/bugs/1832399
Last-Update: 2019-06-11
Applied-Upstream: https://sourceforge.net/p/iperf2/code/ci/4565c2ce318318a8a1d4578bab78c0e03fb49437/
[ dannf: Removed incidental version number changes from commit ]

diff --git a/src/Listener.cpp b/src/Listener.cpp
index 6d28c9b..983da07 100644
--- a/src/Listener.cpp
+++ b/src/Listener.cpp
@@ -73,6 +73,7 @@
 
 #define HEADERS()
 
+#include <limits.h>
 #include "headers.h"
 #include "Listener.hpp"
 #include "SocketAddr.h"
@@ -388,9 +389,9 @@ void Listener::Listen( ) {
 	    FAIL_errno( rc == SOCKET_ERROR, "bind", mSettings );
 	}
     // listen for connections (TCP only).
-    // default backlog traditionally 5
+    // use large (INT_MAX) backlog allowing multiple simultaneous connections
     if ( !isUDP( mSettings ) ) {
-	rc = listen( mSettings->mSock, 5 );
+	rc = listen( mSettings->mSock, INT_MAX );
 	WARN_errno( rc == SOCKET_ERROR, "listen" );
     }
 
-- 
2.20.1

Reply via email to