]> 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)
committerGitLab <gitlab@git.dovecot.net>
Tue, 27 Sep 2016 13:34:36 +0000 (16:34 +0300)
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 a98d7cb22573859b0794ed3f07df9c30f0dd93c3..d46e08ff54a95968e79f0a0e49e18fac99790493 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);
 }