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.
This commit is contained in:
Willy Tarreau 2020-09-01 10:26:22 +02:00
parent c049c0d5ad
commit b3580b19c8
7 changed files with 9 additions and 9 deletions

View File

@ -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 */

View File

@ -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)

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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 <verbose> is set or if they are fatal */
if (verbose || (lerr & (ERR_FATAL | ERR_ABORT))) {