]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: mworker: stop MASTER proxy listener on worker mcli sockpair
authorValentine Krasnobaeva <vkrasnobaeva@haproxy.com>
Tue, 22 Oct 2024 13:09:29 +0000 (15:09 +0200)
committerWilliam Lallemand <wlallemand@haproxy.com>
Thu, 24 Oct 2024 09:32:20 +0000 (11:32 +0200)
After sending its "READY" status worker should not keep the access
to MASTER proxy, thus, it shouldn't be able to send any other commands further
to master process.

To achieve this, let's stop in master context master CLI listener attached on
the sockpair shared with worker. We do this just after receiving the worker's
status message.

src/cli.c

index 57895769927f7f1e8ccec388cebe607f26e30cc2..68ce8176def5ad320aace4b980fd863740af73d6 100644 (file)
--- a/src/cli.c
+++ b/src/cli.c
@@ -2469,6 +2469,7 @@ static int cli_parse_simple(char **args, char *payload, struct appctx *appctx, v
 
 static int _send_status(char **args, char *payload, struct appctx *appctx, void *private)
 {
+       struct listener *mproxy_li;
        struct mworker_proc *proc;
        int pid;
 
@@ -2479,8 +2480,11 @@ static int _send_status(char **args, char *payload, struct appctx *appctx, void
 
        list_for_each_entry(proc, &proc_list, list) {
                /* update status of the new worker */
-               if (proc->pid == pid)
+               if (proc->pid == pid) {
                        proc->options &= ~PROC_O_INIT;
+                       mproxy_li = fdtab[proc->ipc_fd[0]].owner;
+                       stop_listener(mproxy_li, 0, 0, 0);
+               }
                /* send TERM to workers, which have exceeded max_reloads counter */
                if (max_reloads != -1) {
                        if ((proc->options & PROC_O_TYPE_WORKER) &&