]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: mworker: stop proxies which have no listener in the master
authorWilliam Lallemand <wlallemand@haproxy.com>
Mon, 3 Dec 2018 19:34:44 +0000 (20:34 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 4 Dec 2018 04:54:33 +0000 (05:54 +0100)
The previous code was only stopping the listeners in the master, not the
entire proxy.

Since we now have a polling loop in the master, there might be some side
effects, indeed some things that are still initialized. For example the
checks were still running.

src/haproxy.c

index 08ad7e5a2acf84641a211d76f0477678b16ee971..f8fba140fdb0986cbbb5659b7455ff1b56aee06d 100644 (file)
@@ -623,6 +623,8 @@ static void mworker_cleanlisteners()
        }
 
        for (curproxy = proxies_list; curproxy; curproxy = curproxy->next) {
+               int listen_in_master = 0;
+
                list_for_each_entry_safe(l, l_next, &curproxy->conf.listeners, by_fe) {
                        /* remove the listener, but not those we need in the master... */
                        if (!(l->options & LI_O_MWORKER)) {
@@ -634,8 +636,13 @@ static void mworker_cleanlisteners()
                                else
                                        unbind_listener(l);
                                delete_listener(l);
+                       } else {
+                               listen_in_master = 1;
                        }
                }
+               /* if the proxy shouldn't be in the master, we stop it */
+               if (!listen_in_master)
+                       curproxy->state = PR_STSTOPPED;
        }
 }