]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: protocol: rename the ->listeners field to ->receivers
authorWilly Tarreau <w@1wt.eu>
Fri, 25 Sep 2020 15:01:43 +0000 (17:01 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 9 Oct 2020 09:27:30 +0000 (11:27 +0200)
Since the listeners were split into receiver+listener, this field ought
to have been renamed because it's confusing. It really links receivers
and not listeners, as most of the time it's used via rx.proto_list!
The nb_listeners field was updated accordingly.

include/haproxy/protocol-t.h
src/listener.c
src/proto_sockpair.c
src/proto_tcp.c
src/proto_udp.c
src/proto_uxst.c
src/protocol.c

index bf66dc25601dd38810d45d8d838bc867c8b58e82..138dbbb874138cc7ab03046aa37199c2c060dca0 100644 (file)
@@ -90,8 +90,8 @@ struct protocol {
        int (*pause)(struct listener *l);               /* temporarily pause this listener for a soft restart */
        void (*add)(struct listener *l, int port);      /* add a listener for this protocol and port */
 
-       struct list listeners;                          /* list of listeners using this protocol (under proto_lock) */
-       int nb_listeners;                               /* number of listeners (under proto_lock) */
+       struct list receivers;                          /* list of receivers using this protocol (under proto_lock) */
+       int nb_receivers;                               /* number of receivers (under proto_lock) */
        struct list list;                               /* list of registered protocols (under proto_lock) */
 };
 
index ff1d2986b5a4d76dd0986520a36cfd2e4679a319..b24ee5636a0d90528573d96ff8433991c5f520bc 100644 (file)
@@ -592,7 +592,7 @@ void delete_listener(struct listener *listener)
        if (listener->state == LI_ASSIGNED) {
                listener_set_state(listener, LI_INIT);
                LIST_DEL(&listener->rx.proto_list);
-               listener->rx.proto->nb_listeners--;
+               listener->rx.proto->nb_receivers--;
                _HA_ATOMIC_SUB(&jobs, 1);
                _HA_ATOMIC_SUB(&listeners, 1);
        }
index c77308f44508bd764b6527cd54b3c57d4614e42f..d46fa2794522ba50f69050185a331adb76efc248 100644 (file)
@@ -70,8 +70,8 @@ static struct protocol proto_sockpair = {
        .listen = sockpair_bind_listener,
        .pause = NULL,
        .add = sockpair_add_listener,
-       .listeners = LIST_HEAD_INIT(proto_sockpair.listeners),
-       .nb_listeners = 0,
+       .receivers = LIST_HEAD_INIT(proto_sockpair.receivers),
+       .nb_receivers = 0,
 };
 
 INITCALL1(STG_REGISTER, protocol_register, &proto_sockpair);
@@ -89,8 +89,8 @@ static void sockpair_add_listener(struct listener *listener, int port)
                return;
        listener_set_state(listener, LI_ASSIGNED);
        listener->rx.proto = &proto_sockpair;
-       LIST_ADDQ(&proto_sockpair.listeners, &listener->rx.proto_list);
-       proto_sockpair.nb_listeners++;
+       LIST_ADDQ(&proto_sockpair.receivers, &listener->rx.proto_list);
+       proto_sockpair.nb_receivers++;
 }
 
 /* Binds receiver <rx>, and assigns <handler> and rx->owner as the callback and
index 4e6d36a4eb5dba2cb210ff984725e9fae83a0799..93daa5a800c517bd4ff41c8ed1275af0d0430d3d 100644 (file)
@@ -61,8 +61,8 @@ static struct protocol proto_tcpv4 = {
        .listen = tcp_bind_listener,
        .pause = tcp_pause_listener,
        .add = tcpv4_add_listener,
-       .listeners = LIST_HEAD_INIT(proto_tcpv4.listeners),
-       .nb_listeners = 0,
+       .receivers = LIST_HEAD_INIT(proto_tcpv4.receivers),
+       .nb_receivers = 0,
 };
 
 INITCALL1(STG_REGISTER, protocol_register, &proto_tcpv4);
@@ -80,8 +80,8 @@ static struct protocol proto_tcpv6 = {
        .listen = tcp_bind_listener,
        .pause = tcp_pause_listener,
        .add = tcpv6_add_listener,
-       .listeners = LIST_HEAD_INIT(proto_tcpv6.listeners),
-       .nb_listeners = 0,
+       .receivers = LIST_HEAD_INIT(proto_tcpv6.receivers),
+       .nb_receivers = 0,
 };
 
 INITCALL1(STG_REGISTER, protocol_register, &proto_tcpv6);
@@ -703,8 +703,8 @@ static void tcpv4_add_listener(struct listener *listener, int port)
        listener_set_state(listener, LI_ASSIGNED);
        listener->rx.proto = &proto_tcpv4;
        ((struct sockaddr_in *)(&listener->rx.addr))->sin_port = htons(port);
-       LIST_ADDQ(&proto_tcpv4.listeners, &listener->rx.proto_list);
-       proto_tcpv4.nb_listeners++;
+       LIST_ADDQ(&proto_tcpv4.receivers, &listener->rx.proto_list);
+       proto_tcpv4.nb_receivers++;
 }
 
 /* Add <listener> to the list of tcpv6 listeners, on port <port>. The
@@ -721,8 +721,8 @@ static void tcpv6_add_listener(struct listener *listener, int port)
        listener_set_state(listener, LI_ASSIGNED);
        listener->rx.proto = &proto_tcpv6;
        ((struct sockaddr_in *)(&listener->rx.addr))->sin_port = htons(port);
-       LIST_ADDQ(&proto_tcpv6.listeners, &listener->rx.proto_list);
-       proto_tcpv6.nb_listeners++;
+       LIST_ADDQ(&proto_tcpv6.receivers, &listener->rx.proto_list);
+       proto_tcpv6.nb_receivers++;
 }
 
 /* Pause a listener. Returns < 0 in case of failure, 0 if the listener
index aa2416f1200b23f1099b2fca99a7f2e8b4eb380f..44593b90cae05ad5d7f1bb42f09b933fe28ee28f 100644 (file)
@@ -57,8 +57,8 @@ static struct protocol proto_udp4 = {
        .listen = udp_bind_listener,
        .pause = udp_pause_listener,
        .add = udp4_add_listener,
-       .listeners = LIST_HEAD_INIT(proto_udp4.listeners),
-       .nb_listeners = 0,
+       .receivers = LIST_HEAD_INIT(proto_udp4.receivers),
+       .nb_receivers = 0,
 };
 
 INITCALL1(STG_REGISTER, protocol_register, &proto_udp4);
@@ -76,8 +76,8 @@ static struct protocol proto_udp6 = {
        .listen = udp_bind_listener,
        .pause = udp_pause_listener,
        .add = udp6_add_listener,
-       .listeners = LIST_HEAD_INIT(proto_udp6.listeners),
-       .nb_listeners = 0,
+       .receivers = LIST_HEAD_INIT(proto_udp6.receivers),
+       .nb_receivers = 0,
 };
 
 INITCALL1(STG_REGISTER, protocol_register, &proto_udp6);
@@ -135,8 +135,8 @@ static void udp4_add_listener(struct listener *listener, int port)
        listener_set_state(listener, LI_ASSIGNED);
        listener->rx.proto = &proto_udp4;
        ((struct sockaddr_in *)(&listener->rx.addr))->sin_port = htons(port);
-       LIST_ADDQ(&proto_udp4.listeners, &listener->rx.proto_list);
-       proto_udp4.nb_listeners++;
+       LIST_ADDQ(&proto_udp4.receivers, &listener->rx.proto_list);
+       proto_udp4.nb_receivers++;
 }
 
 /* Add <listener> to the list of udp6 listeners, on port <port>. The
@@ -150,8 +150,8 @@ static void udp6_add_listener(struct listener *listener, int port)
        listener_set_state(listener, LI_ASSIGNED);
        listener->rx.proto = &proto_udp6;
        ((struct sockaddr_in *)(&listener->rx.addr))->sin_port = htons(port);
-       LIST_ADDQ(&proto_udp6.listeners, &listener->rx.proto_list);
-       proto_udp6.nb_listeners++;
+       LIST_ADDQ(&proto_udp6.receivers, &listener->rx.proto_list);
+       proto_udp6.nb_receivers++;
 }
 
 /* Pause a listener. Returns < 0 in case of failure, 0 if the listener
index 96d96b3ce17d375c28acddd5b4e740a62a788f3d..26109278ef31397cbd749a5225644e910c4b552a 100644 (file)
@@ -58,8 +58,8 @@ static struct protocol proto_unix = {
        .listen = uxst_bind_listener,
        .pause = uxst_pause_listener,
        .add = uxst_add_listener,
-       .listeners = LIST_HEAD_INIT(proto_unix.listeners),
-       .nb_listeners = 0,
+       .receivers = LIST_HEAD_INIT(proto_unix.receivers),
+       .nb_receivers = 0,
 };
 
 INITCALL1(STG_REGISTER, protocol_register, &proto_unix);
@@ -142,8 +142,8 @@ static void uxst_add_listener(struct listener *listener, int port)
                return;
        listener_set_state(listener, LI_ASSIGNED);
        listener->rx.proto = &proto_unix;
-       LIST_ADDQ(&proto_unix.listeners, &listener->rx.proto_list);
-       proto_unix.nb_listeners++;
+       LIST_ADDQ(&proto_unix.receivers, &listener->rx.proto_list);
+       proto_unix.nb_receivers++;
 }
 
 /* Pause a listener. Returns < 0 in case of failure, 0 if the listener
index c9d26754baef9a153bbab8d5bd29ebc994462eb9..c0a00904ca85540087434c319c45a7b8322dbf80 100644 (file)
@@ -71,7 +71,7 @@ int protocol_bind_all(int verbose)
        err = 0;
        HA_SPIN_LOCK(PROTO_LOCK, &proto_lock);
        list_for_each_entry(proto, &protocols, list) {
-               list_for_each_entry(receiver, &proto->listeners, proto_list) {
+               list_for_each_entry(receiver, &proto->receivers, proto_list) {
                        listener = LIST_ELEM(receiver, struct listener *, rx);
 
                        /* FIXME: horrible hack, we don't have a way to register
@@ -144,7 +144,7 @@ int protocol_unbind_all(void)
        err = 0;
        HA_SPIN_LOCK(PROTO_LOCK, &proto_lock);
        list_for_each_entry(proto, &protocols, list) {
-               list_for_each_entry(listener, &proto->listeners, rx.proto_list)
+               list_for_each_entry(listener, &proto->receivers, rx.proto_list)
                        unbind_listener(listener);
        }
        HA_SPIN_UNLOCK(PROTO_LOCK, &proto_lock);
@@ -165,7 +165,7 @@ int protocol_pause_all(void)
        err = 0;
        HA_SPIN_LOCK(PROTO_LOCK, &proto_lock);
        list_for_each_entry(proto, &protocols, list) {
-               list_for_each_entry(listener, &proto->listeners, rx.proto_list)
+               list_for_each_entry(listener, &proto->receivers, rx.proto_list)
                        if (!pause_listener(listener))
                                err |= ERR_FATAL;
        }
@@ -187,7 +187,7 @@ int protocol_resume_all(void)
        err = 0;
        HA_SPIN_LOCK(PROTO_LOCK, &proto_lock);
        list_for_each_entry(proto, &protocols, list) {
-               list_for_each_entry(listener, &proto->listeners, rx.proto_list)
+               list_for_each_entry(listener, &proto->receivers, rx.proto_list)
                        if (!resume_listener(listener))
                                err |= ERR_FATAL;
        }
@@ -206,7 +206,7 @@ int protocol_enable_all(void)
 
        HA_SPIN_LOCK(PROTO_LOCK, &proto_lock);
        list_for_each_entry(proto, &protocols, list) {
-               list_for_each_entry(listener, &proto->listeners, rx.proto_list)
+               list_for_each_entry(listener, &proto->receivers, rx.proto_list)
                        enable_listener(listener);
        }
        HA_SPIN_UNLOCK(PROTO_LOCK, &proto_lock);