]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: init: move some maxsock updates earlier
authorWilly Tarreau <w@1wt.eu>
Fri, 1 Mar 2019 08:39:42 +0000 (09:39 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 1 Mar 2019 14:53:14 +0000 (15:53 +0100)
We'll need to know the global maxsock before the maxconn calculation.
Actually only two components were calculated too late, the peers FD
and the stats FD. Let's move them a few lines upward.

src/haproxy.c

index 21bfcbd97aa5f34016d31a95087b9134ec5c1ec5..22cd51e8beb9db65fa9d1367258335a44e6e50c9 100644 (file)
@@ -1940,6 +1940,18 @@ static void init(int argc, char **argv)
        if (cfg_maxconn > 0)
                global.maxconn = cfg_maxconn;
 
+       if (global.stats_fe)
+               global.maxsock += global.stats_fe->maxconn;
+
+       if (cfg_peers) {
+               /* peers also need to bypass global maxconn */
+               struct peers *p = cfg_peers;
+
+               for (p = cfg_peers; p; p = p->next)
+                       if (p->peers_fe)
+                               global.maxsock += p->peers_fe->maxconn;
+       }
+
        if (cfg_pidfile) {
                free(global.pidfile);
                global.pidfile = strdup(cfg_pidfile);
@@ -2098,18 +2110,6 @@ static void init(int argc, char **argv)
                global.maxsock += global.maxconn * sides * global.ssl_used_async_engines;
        }
 
-       if (global.stats_fe)
-               global.maxsock += global.stats_fe->maxconn;
-
-       if (cfg_peers) {
-               /* peers also need to bypass global maxconn */
-               struct peers *p = cfg_peers;
-
-               for (p = cfg_peers; p; p = p->next)
-                       if (p->peers_fe)
-                               global.maxsock += p->peers_fe->maxconn;
-       }
-
        proxy_adjust_all_maxconn();
 
        if (global.tune.maxpollevents <= 0)