diff options
author | Willy Tarreau <w@1wt.eu> | 2020-09-25 17:01:43 +0200 |
---|---|---|
committer | Willy Tarreau <w@1wt.eu> | 2020-10-07 18:45:03 +0200 |
commit | 1deb0bf3f5b8de1d1acd1786aeee1f68d76224de (patch) | |
tree | 8eebc999e0f296d5d5c8b6a8ba833e05caa6e125 | |
parent | afe2c71ed6e2d68b39ed087c42eb37f3c101c543 (diff) | |
download | haproxy-1deb0bf3f5b8de1d1acd1786aeee1f68d76224de.tar.gz |
MINOR: protocol: rename the ->listeners field to ->receivers
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.
-rw-r--r-- | include/haproxy/protocol-t.h | 4 | ||||
-rw-r--r-- | src/listener.c | 2 | ||||
-rw-r--r-- | src/proto_sockpair.c | 8 | ||||
-rw-r--r-- | src/proto_tcp.c | 16 | ||||
-rw-r--r-- | src/proto_udp.c | 16 | ||||
-rw-r--r-- | src/proto_uxst.c | 8 | ||||
-rw-r--r-- | src/protocol.c | 10 |
7 files changed, 32 insertions, 32 deletions
diff --git a/include/haproxy/protocol-t.h b/include/haproxy/protocol-t.h index bf66dc256..138dbbb87 100644 --- a/include/haproxy/protocol-t.h +++ b/include/haproxy/protocol-t.h @@ -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) */ }; diff --git a/src/listener.c b/src/listener.c index f611bf79f..db2071278 100644 --- a/src/listener.c +++ b/src/listener.c @@ -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); } diff --git a/src/proto_sockpair.c b/src/proto_sockpair.c index c77308f44..d46fa2794 100644 --- a/src/proto_sockpair.c +++ b/src/proto_sockpair.c @@ -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 diff --git a/src/proto_tcp.c b/src/proto_tcp.c index 6110760f7..9eaa7e764 100644 --- a/src/proto_tcp.c +++ b/src/proto_tcp.c @@ -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 diff --git a/src/proto_udp.c b/src/proto_udp.c index aa2416f12..44593b90c 100644 --- a/src/proto_udp.c +++ b/src/proto_udp.c @@ -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 diff --git a/src/proto_uxst.c b/src/proto_uxst.c index 96d96b3ce..26109278e 100644 --- a/src/proto_uxst.c +++ b/src/proto_uxst.c @@ -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 diff --git a/src/protocol.c b/src/protocol.c index c9d26754b..c0a00904c 100644 --- a/src/protocol.c +++ b/src/protocol.c @@ -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); |