From 26ad5465cc55ca1d181ae3b314beb23f37fb6110 Mon Sep 17 00:00:00 2001 From: Valentine Krasnobaeva Date: Mon, 14 Oct 2024 11:27:21 +0200 Subject: [PATCH] MINOR: mworker/cli: create MASTER proxy before mcli listeners 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 | 9 ++++++++- src/mworker.c | 5 ----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/haproxy.c b/src/haproxy.c index e20f36052..e9198704b 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -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(); } } diff --git a/src/mworker.c b/src/mworker.c index c125a1696..967bf7cfa 100644 --- a/src/mworker.c +++ b/src/mworker.c @@ -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");