From: Willy Tarreau Date: Tue, 1 Sep 2020 08:26:22 +0000 (+0200) Subject: MINOR: protocol: rename the ->bind field to ->listen X-Git-Tag: v2.3-dev5~57 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b3580b19c808e9d899879eca846db63ff5d7ffb8;p=thirdparty%2Fhaproxy.git MINOR: protocol: rename the ->bind field to ->listen The function currently is doing both the bind() and the listen(), so let's call it ->listen so that the bind() operation can move to another place. --- diff --git a/include/haproxy/protocol-t.h b/include/haproxy/protocol-t.h index 15396275b3..07532e1261 100644 --- a/include/haproxy/protocol-t.h +++ b/include/haproxy/protocol-t.h @@ -71,7 +71,7 @@ struct protocol { socklen_t sock_addrlen; /* socket address length, used by bind() */ int l3_addrlen; /* layer3 address length, used by hashes */ void (*accept)(int fd); /* generic accept function */ - int (*bind)(struct listener *l, char *errmsg, int errlen); /* bind a listener */ + int (*listen)(struct listener *l, char *errmsg, int errlen); /* start a listener */ int (*enable_all)(struct protocol *proto); /* enable all bound listeners */ int (*disable_all)(struct protocol *proto); /* disable all bound listeners */ int (*connect)(struct connection *, int flags); /* connect function if any, see below for flags values */ diff --git a/src/listener.c b/src/listener.c index ededb1aa51..627f9200b8 100644 --- a/src/listener.c +++ b/src/listener.c @@ -349,7 +349,7 @@ int resume_listener(struct listener *l) char msg[100]; int err; - err = l->rx.proto->bind(l, msg, sizeof(msg)); + err = l->rx.proto->listen(l, msg, sizeof(msg)); if (err & ERR_ALERT) ha_alert("Resuming listener: %s\n", msg); else if (err & ERR_WARN) diff --git a/src/proto_sockpair.c b/src/proto_sockpair.c index d25ab5a424..c5361c6783 100644 --- a/src/proto_sockpair.c +++ b/src/proto_sockpair.c @@ -55,7 +55,7 @@ static struct protocol proto_sockpair = { .l3_addrlen = sizeof(((struct sockaddr_un*)0)->sun_path),/* path len */ .accept = &listener_accept, .connect = &sockpair_connect_server, - .bind = sockpair_bind_listener, + .listen = sockpair_bind_listener, .enable_all = enable_all_listeners, .disable_all = disable_all_listeners, .get_src = NULL, diff --git a/src/proto_tcp.c b/src/proto_tcp.c index 258a72ddc6..a400b0fa99 100644 --- a/src/proto_tcp.c +++ b/src/proto_tcp.c @@ -59,7 +59,7 @@ static struct protocol proto_tcpv4 = { .l3_addrlen = 32/8, .accept = &listener_accept, .connect = tcp_connect_server, - .bind = tcp_bind_listener, + .listen = tcp_bind_listener, .enable_all = enable_all_listeners, .get_src = sock_get_src, .get_dst = sock_inet_get_dst, @@ -83,7 +83,7 @@ static struct protocol proto_tcpv6 = { .l3_addrlen = 128/8, .accept = &listener_accept, .connect = tcp_connect_server, - .bind = tcp_bind_listener, + .listen = tcp_bind_listener, .enable_all = enable_all_listeners, .get_src = sock_get_src, .get_dst = sock_get_dst, diff --git a/src/proto_udp.c b/src/proto_udp.c index 82a93873ec..eea2583ac6 100644 --- a/src/proto_udp.c +++ b/src/proto_udp.c @@ -55,7 +55,7 @@ static struct protocol proto_udp4 = { .l3_addrlen = 32/8, .accept = NULL, .connect = NULL, - .bind = udp_bind_listener, + .listen = udp_bind_listener, .enable_all = enable_all_listeners, .get_src = udp_get_src, .get_dst = udp_get_dst, @@ -79,7 +79,7 @@ static struct protocol proto_udp6 = { .l3_addrlen = 128/8, .accept = NULL, .connect = NULL, - .bind = udp_bind_listener, + .listen = udp_bind_listener, .enable_all = enable_all_listeners, .get_src = udp6_get_src, .get_dst = udp6_get_dst, diff --git a/src/proto_uxst.c b/src/proto_uxst.c index 6691e85ab1..24ab191dd5 100644 --- a/src/proto_uxst.c +++ b/src/proto_uxst.c @@ -56,7 +56,7 @@ static struct protocol proto_unix = { .l3_addrlen = sizeof(((struct sockaddr_un*)0)->sun_path),/* path len */ .accept = &listener_accept, .connect = &uxst_connect_server, - .bind = uxst_bind_listener, + .listen = uxst_bind_listener, .enable_all = enable_all_listeners, .disable_all = disable_all_listeners, .get_src = sock_get_src, diff --git a/src/protocol.c b/src/protocol.c index bf1b1c5cbd..6ea60337a2 100644 --- a/src/protocol.c +++ b/src/protocol.c @@ -67,7 +67,7 @@ int protocol_bind_all(int verbose) HA_SPIN_LOCK(PROTO_LOCK, &proto_lock); list_for_each_entry(proto, &protocols, list) { list_for_each_entry(listener, &proto->listeners, rx.proto_list) { - lerr = proto->bind(listener, msg, sizeof(msg)); + lerr = proto->listen(listener, msg, sizeof(msg)); /* errors are reported if is set or if they are fatal */ if (verbose || (lerr & (ERR_FATAL | ERR_ABORT))) {