]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: protocol: do not call proto->unbind_all() anymore
authorWilly Tarreau <w@1wt.eu>
Wed, 2 Sep 2020 08:31:31 +0000 (10:31 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 2 Sep 2020 08:39:31 +0000 (10:39 +0200)
Similarly to previous commit about ->bind_all(), we have the same
construct for ->unbind_all() which ought not to be used either. Let's
make protocol_unbind_all() iterate over all listeners and directly
call unbind_listener() instead.

It's worth noting that for uxst there was originally a specific
->unbind_all() function but the simplifications that came over the
years have resulted in a locally reimplemented version of the same
function: the test on (state > LI_ASSIGNED) there is equivalent to
the one on (state >= LI_PAUSED) that is used in do_unbind_listener(),
and it seems these have been equivalent since at least commit dabf2e264
("[MAJOR] added a new state to listeners")) (1.3.14).

src/protocol.c

index faa634192dfe02adaf4abca0d039faa50c0ea37f..84c85d2dd8dc56ac466c619ae20ccf5782933d86 100644 (file)
@@ -82,14 +82,14 @@ int protocol_bind_all(char *errmsg, int errlen)
 int protocol_unbind_all(void)
 {
        struct protocol *proto;
+       struct listener *listener;
        int err;
 
        err = 0;
        HA_SPIN_LOCK(PROTO_LOCK, &proto_lock);
        list_for_each_entry(proto, &protocols, list) {
-               if (proto->unbind_all) {
-                       err |= proto->unbind_all(proto);
-               }
+               list_for_each_entry(listener, &proto->listeners, proto_list)
+                       unbind_listener(listener);
        }
        HA_SPIN_UNLOCK(PROTO_LOCK, &proto_lock);
        return err;