]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: mworker/cli: create MASTER proxy before mcli listeners
authorValentine Krasnobaeva <vkrasnobaeva@haproxy.com>
Mon, 14 Oct 2024 09:27:21 +0000 (11:27 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 16 Oct 2024 20:02:39 +0000 (22:02 +0200)
For the master process we always need to create a MASTER proxy, even if
master cli settings were not provided via command line, because now we bind a
listener in the master process context at ipc_fd[0]. So, MASTER proxy should be
already allocated at this moment.

src/haproxy.c
src/mworker.c

index e20f36052770fb573d1e8fc565891bbd8431fc48..e9198704b652bd2d4fc17b542354b163a1af02c4 100644 (file)
@@ -2217,7 +2217,14 @@ static void init(int argc, char **argv)
                         */
                        global.nbtgroups = 1;
                        global.nbthread = 1;
-                       /* master CLI */
+
+                       /* creates MASTER proxy and attaches server to child->ipc_fd[0] */
+                       if (mworker_cli_proxy_create() < 0) {
+                               ha_alert("Can't create the master's CLI.\n");
+                               exit(EXIT_FAILURE);
+                       }
+
+                       /* creates reload sockpair and listeners for master CLI (-S) */
                        mworker_create_master_cli();
                }
        }
index c125a1696cece5329af73b3bda2c17c7d9a164d6..967bf7cfaee47765f307c44662acc49af5de7d7d 100644 (file)
@@ -803,11 +803,6 @@ void mworker_create_master_cli(void)
        if (!LIST_ISEMPTY(&mworker_cli_conf)) {
                char *path = NULL;
 
-               if (mworker_cli_proxy_create() < 0) {
-                       ha_alert("Can't create the master's CLI.\n");
-                       exit(EXIT_FAILURE);
-               }
-
                list_for_each_entry_safe(c, it, &mworker_cli_conf, list) {
                        if (mworker_cli_master_proxy_new_listener(c->s) == NULL) {
                                ha_alert("Can't create the master's CLI.\n");