]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
master: Removed hardcoded listen() backlog limit.
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Tue, 27 Sep 2016 12:50:11 +0000 (15:50 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Thu, 13 Oct 2016 08:18:12 +0000 (10:18 +0200)
If it's already too large, the kernel will truncate it automatically. So
there shouldn't be any reason for us to explicitly limit it.

src/master/service-listen.c

index ee3fbc61e43274dceb6a7f16efb3725ae566490c..fa12e92fd6aa0d47e1127548263de9ea8dfb1499 100644 (file)
@@ -18,7 +18,6 @@
 #include <sys/socket.h>
 
 #define MIN_BACKLOG 4
-#define MAX_BACKLOG 511
 
 static unsigned int service_get_backlog(struct service *service)
 {
@@ -28,14 +27,10 @@ static unsigned int service_get_backlog(struct service *service)
        i_assert(service->client_limit > 0);
 
        /* as unlikely as it is, avoid overflows */
-       if (service->process_limit > MAX_BACKLOG ||
-           service->client_limit > MAX_BACKLOG)
-               backlog = MAX_BACKLOG;
-       else {
+       if (service->client_limit > INT_MAX / service->process_limit)
+               backlog = INT_MAX;
+       else
                backlog = service->process_limit * service->client_limit;
-               if (backlog > MAX_BACKLOG)
-                       backlog = MAX_BACKLOG;
-       }
        return I_MAX(backlog, MIN_BACKLOG);
 }