]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: config: only report a warning when stats sockets are bound to more than 1...
authorWilly Tarreau <w@1wt.eu>
Fri, 9 May 2014 16:48:46 +0000 (18:48 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 9 May 2014 17:16:26 +0000 (19:16 +0200)
Till now a warning was emitted if the "stats bind-process" was not
specified when nbproc was greater than 1. Now we can be much finer
and only emit a warning when at least of the stats socket is bound
to more than one process at a time.

src/cfgparse.c

index 23e2bdd18826f401ede422d99342c7e265ee4744..1cdda34d1f7efe9f05abfa9c9ba9bf1f2c07485c 100644 (file)
@@ -6950,8 +6950,22 @@ out_uri_auth_compat:
 
        /* Check multi-process mode compatibility */
        if (global.nbproc > 1) {
-               if (global.stats_fe && !global.stats_fe->bind_proc) {
-                       Warning("stats socket will not work as expected in multi-process mode (nbproc > 1), you should force process binding using 'stats bind-process'.\n");
+               list_for_each_entry(bind_conf, &global.stats_fe->conf.bind, by_fe) {
+                       unsigned long mask;
+
+                       mask = nbits(global.nbproc);
+                       if (global.stats_fe->bind_proc)
+                               mask &= global.stats_fe->bind_proc;
+
+                       if (bind_conf->bind_proc)
+                               mask &= bind_conf->bind_proc;
+
+                       /* stop here if more than one process is used */
+                       if (popcount(mask) > 1)
+                               break;
+               }
+               if (&bind_conf->by_fe != &global.stats_fe->conf.bind) {
+                       Warning("stats socket will not work as expected in multi-process mode (nbproc > 1), you should force process binding globally using 'stats bind-process' or per socket using the 'process' attribute.\n");
                }
        }