mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-07 15:47:01 +02:00
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.
This commit is contained in:
parent
dae0692717
commit
d7f331c8b8
@ -90,8 +90,8 @@ struct protocol {
|
|||||||
int (*pause)(struct listener *l); /* temporarily pause this listener for a soft restart */
|
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 */
|
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) */
|
struct list receivers; /* list of receivers using this protocol (under proto_lock) */
|
||||||
int nb_listeners; /* number of listeners (under proto_lock) */
|
int nb_receivers; /* number of receivers (under proto_lock) */
|
||||||
struct list list; /* list of registered protocols (under proto_lock) */
|
struct list list; /* list of registered protocols (under proto_lock) */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -592,7 +592,7 @@ void delete_listener(struct listener *listener)
|
|||||||
if (listener->state == LI_ASSIGNED) {
|
if (listener->state == LI_ASSIGNED) {
|
||||||
listener_set_state(listener, LI_INIT);
|
listener_set_state(listener, LI_INIT);
|
||||||
LIST_DEL(&listener->rx.proto_list);
|
LIST_DEL(&listener->rx.proto_list);
|
||||||
listener->rx.proto->nb_listeners--;
|
listener->rx.proto->nb_receivers--;
|
||||||
_HA_ATOMIC_SUB(&jobs, 1);
|
_HA_ATOMIC_SUB(&jobs, 1);
|
||||||
_HA_ATOMIC_SUB(&listeners, 1);
|
_HA_ATOMIC_SUB(&listeners, 1);
|
||||||
}
|
}
|
||||||
|
@ -70,8 +70,8 @@ static struct protocol proto_sockpair = {
|
|||||||
.listen = sockpair_bind_listener,
|
.listen = sockpair_bind_listener,
|
||||||
.pause = NULL,
|
.pause = NULL,
|
||||||
.add = sockpair_add_listener,
|
.add = sockpair_add_listener,
|
||||||
.listeners = LIST_HEAD_INIT(proto_sockpair.listeners),
|
.receivers = LIST_HEAD_INIT(proto_sockpair.receivers),
|
||||||
.nb_listeners = 0,
|
.nb_receivers = 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
INITCALL1(STG_REGISTER, protocol_register, &proto_sockpair);
|
INITCALL1(STG_REGISTER, protocol_register, &proto_sockpair);
|
||||||
@ -89,8 +89,8 @@ static void sockpair_add_listener(struct listener *listener, int port)
|
|||||||
return;
|
return;
|
||||||
listener_set_state(listener, LI_ASSIGNED);
|
listener_set_state(listener, LI_ASSIGNED);
|
||||||
listener->rx.proto = &proto_sockpair;
|
listener->rx.proto = &proto_sockpair;
|
||||||
LIST_ADDQ(&proto_sockpair.listeners, &listener->rx.proto_list);
|
LIST_ADDQ(&proto_sockpair.receivers, &listener->rx.proto_list);
|
||||||
proto_sockpair.nb_listeners++;
|
proto_sockpair.nb_receivers++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Binds receiver <rx>, and assigns <handler> and rx->owner as the callback and
|
/* Binds receiver <rx>, and assigns <handler> and rx->owner as the callback and
|
||||||
|
@ -61,8 +61,8 @@ static struct protocol proto_tcpv4 = {
|
|||||||
.listen = tcp_bind_listener,
|
.listen = tcp_bind_listener,
|
||||||
.pause = tcp_pause_listener,
|
.pause = tcp_pause_listener,
|
||||||
.add = tcpv4_add_listener,
|
.add = tcpv4_add_listener,
|
||||||
.listeners = LIST_HEAD_INIT(proto_tcpv4.listeners),
|
.receivers = LIST_HEAD_INIT(proto_tcpv4.receivers),
|
||||||
.nb_listeners = 0,
|
.nb_receivers = 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
INITCALL1(STG_REGISTER, protocol_register, &proto_tcpv4);
|
INITCALL1(STG_REGISTER, protocol_register, &proto_tcpv4);
|
||||||
@ -80,8 +80,8 @@ static struct protocol proto_tcpv6 = {
|
|||||||
.listen = tcp_bind_listener,
|
.listen = tcp_bind_listener,
|
||||||
.pause = tcp_pause_listener,
|
.pause = tcp_pause_listener,
|
||||||
.add = tcpv6_add_listener,
|
.add = tcpv6_add_listener,
|
||||||
.listeners = LIST_HEAD_INIT(proto_tcpv6.listeners),
|
.receivers = LIST_HEAD_INIT(proto_tcpv6.receivers),
|
||||||
.nb_listeners = 0,
|
.nb_receivers = 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
INITCALL1(STG_REGISTER, protocol_register, &proto_tcpv6);
|
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_set_state(listener, LI_ASSIGNED);
|
||||||
listener->rx.proto = &proto_tcpv4;
|
listener->rx.proto = &proto_tcpv4;
|
||||||
((struct sockaddr_in *)(&listener->rx.addr))->sin_port = htons(port);
|
((struct sockaddr_in *)(&listener->rx.addr))->sin_port = htons(port);
|
||||||
LIST_ADDQ(&proto_tcpv4.listeners, &listener->rx.proto_list);
|
LIST_ADDQ(&proto_tcpv4.receivers, &listener->rx.proto_list);
|
||||||
proto_tcpv4.nb_listeners++;
|
proto_tcpv4.nb_receivers++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add <listener> to the list of tcpv6 listeners, on port <port>. The
|
/* 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_set_state(listener, LI_ASSIGNED);
|
||||||
listener->rx.proto = &proto_tcpv6;
|
listener->rx.proto = &proto_tcpv6;
|
||||||
((struct sockaddr_in *)(&listener->rx.addr))->sin_port = htons(port);
|
((struct sockaddr_in *)(&listener->rx.addr))->sin_port = htons(port);
|
||||||
LIST_ADDQ(&proto_tcpv6.listeners, &listener->rx.proto_list);
|
LIST_ADDQ(&proto_tcpv6.receivers, &listener->rx.proto_list);
|
||||||
proto_tcpv6.nb_listeners++;
|
proto_tcpv6.nb_receivers++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Pause a listener. Returns < 0 in case of failure, 0 if the listener
|
/* Pause a listener. Returns < 0 in case of failure, 0 if the listener
|
||||||
|
@ -57,8 +57,8 @@ static struct protocol proto_udp4 = {
|
|||||||
.listen = udp_bind_listener,
|
.listen = udp_bind_listener,
|
||||||
.pause = udp_pause_listener,
|
.pause = udp_pause_listener,
|
||||||
.add = udp4_add_listener,
|
.add = udp4_add_listener,
|
||||||
.listeners = LIST_HEAD_INIT(proto_udp4.listeners),
|
.receivers = LIST_HEAD_INIT(proto_udp4.receivers),
|
||||||
.nb_listeners = 0,
|
.nb_receivers = 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
INITCALL1(STG_REGISTER, protocol_register, &proto_udp4);
|
INITCALL1(STG_REGISTER, protocol_register, &proto_udp4);
|
||||||
@ -76,8 +76,8 @@ static struct protocol proto_udp6 = {
|
|||||||
.listen = udp_bind_listener,
|
.listen = udp_bind_listener,
|
||||||
.pause = udp_pause_listener,
|
.pause = udp_pause_listener,
|
||||||
.add = udp6_add_listener,
|
.add = udp6_add_listener,
|
||||||
.listeners = LIST_HEAD_INIT(proto_udp6.listeners),
|
.receivers = LIST_HEAD_INIT(proto_udp6.receivers),
|
||||||
.nb_listeners = 0,
|
.nb_receivers = 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
INITCALL1(STG_REGISTER, protocol_register, &proto_udp6);
|
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_set_state(listener, LI_ASSIGNED);
|
||||||
listener->rx.proto = &proto_udp4;
|
listener->rx.proto = &proto_udp4;
|
||||||
((struct sockaddr_in *)(&listener->rx.addr))->sin_port = htons(port);
|
((struct sockaddr_in *)(&listener->rx.addr))->sin_port = htons(port);
|
||||||
LIST_ADDQ(&proto_udp4.listeners, &listener->rx.proto_list);
|
LIST_ADDQ(&proto_udp4.receivers, &listener->rx.proto_list);
|
||||||
proto_udp4.nb_listeners++;
|
proto_udp4.nb_receivers++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add <listener> to the list of udp6 listeners, on port <port>. The
|
/* 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_set_state(listener, LI_ASSIGNED);
|
||||||
listener->rx.proto = &proto_udp6;
|
listener->rx.proto = &proto_udp6;
|
||||||
((struct sockaddr_in *)(&listener->rx.addr))->sin_port = htons(port);
|
((struct sockaddr_in *)(&listener->rx.addr))->sin_port = htons(port);
|
||||||
LIST_ADDQ(&proto_udp6.listeners, &listener->rx.proto_list);
|
LIST_ADDQ(&proto_udp6.receivers, &listener->rx.proto_list);
|
||||||
proto_udp6.nb_listeners++;
|
proto_udp6.nb_receivers++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Pause a listener. Returns < 0 in case of failure, 0 if the listener
|
/* Pause a listener. Returns < 0 in case of failure, 0 if the listener
|
||||||
|
@ -58,8 +58,8 @@ static struct protocol proto_unix = {
|
|||||||
.listen = uxst_bind_listener,
|
.listen = uxst_bind_listener,
|
||||||
.pause = uxst_pause_listener,
|
.pause = uxst_pause_listener,
|
||||||
.add = uxst_add_listener,
|
.add = uxst_add_listener,
|
||||||
.listeners = LIST_HEAD_INIT(proto_unix.listeners),
|
.receivers = LIST_HEAD_INIT(proto_unix.receivers),
|
||||||
.nb_listeners = 0,
|
.nb_receivers = 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
INITCALL1(STG_REGISTER, protocol_register, &proto_unix);
|
INITCALL1(STG_REGISTER, protocol_register, &proto_unix);
|
||||||
@ -142,8 +142,8 @@ static void uxst_add_listener(struct listener *listener, int port)
|
|||||||
return;
|
return;
|
||||||
listener_set_state(listener, LI_ASSIGNED);
|
listener_set_state(listener, LI_ASSIGNED);
|
||||||
listener->rx.proto = &proto_unix;
|
listener->rx.proto = &proto_unix;
|
||||||
LIST_ADDQ(&proto_unix.listeners, &listener->rx.proto_list);
|
LIST_ADDQ(&proto_unix.receivers, &listener->rx.proto_list);
|
||||||
proto_unix.nb_listeners++;
|
proto_unix.nb_receivers++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Pause a listener. Returns < 0 in case of failure, 0 if the listener
|
/* Pause a listener. Returns < 0 in case of failure, 0 if the listener
|
||||||
|
@ -71,7 +71,7 @@ int protocol_bind_all(int verbose)
|
|||||||
err = 0;
|
err = 0;
|
||||||
HA_SPIN_LOCK(PROTO_LOCK, &proto_lock);
|
HA_SPIN_LOCK(PROTO_LOCK, &proto_lock);
|
||||||
list_for_each_entry(proto, &protocols, list) {
|
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);
|
listener = LIST_ELEM(receiver, struct listener *, rx);
|
||||||
|
|
||||||
/* FIXME: horrible hack, we don't have a way to register
|
/* FIXME: horrible hack, we don't have a way to register
|
||||||
@ -144,7 +144,7 @@ int protocol_unbind_all(void)
|
|||||||
err = 0;
|
err = 0;
|
||||||
HA_SPIN_LOCK(PROTO_LOCK, &proto_lock);
|
HA_SPIN_LOCK(PROTO_LOCK, &proto_lock);
|
||||||
list_for_each_entry(proto, &protocols, list) {
|
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);
|
unbind_listener(listener);
|
||||||
}
|
}
|
||||||
HA_SPIN_UNLOCK(PROTO_LOCK, &proto_lock);
|
HA_SPIN_UNLOCK(PROTO_LOCK, &proto_lock);
|
||||||
@ -165,7 +165,7 @@ int protocol_pause_all(void)
|
|||||||
err = 0;
|
err = 0;
|
||||||
HA_SPIN_LOCK(PROTO_LOCK, &proto_lock);
|
HA_SPIN_LOCK(PROTO_LOCK, &proto_lock);
|
||||||
list_for_each_entry(proto, &protocols, list) {
|
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))
|
if (!pause_listener(listener))
|
||||||
err |= ERR_FATAL;
|
err |= ERR_FATAL;
|
||||||
}
|
}
|
||||||
@ -187,7 +187,7 @@ int protocol_resume_all(void)
|
|||||||
err = 0;
|
err = 0;
|
||||||
HA_SPIN_LOCK(PROTO_LOCK, &proto_lock);
|
HA_SPIN_LOCK(PROTO_LOCK, &proto_lock);
|
||||||
list_for_each_entry(proto, &protocols, list) {
|
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))
|
if (!resume_listener(listener))
|
||||||
err |= ERR_FATAL;
|
err |= ERR_FATAL;
|
||||||
}
|
}
|
||||||
@ -206,7 +206,7 @@ int protocol_enable_all(void)
|
|||||||
|
|
||||||
HA_SPIN_LOCK(PROTO_LOCK, &proto_lock);
|
HA_SPIN_LOCK(PROTO_LOCK, &proto_lock);
|
||||||
list_for_each_entry(proto, &protocols, list) {
|
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);
|
enable_listener(listener);
|
||||||
}
|
}
|
||||||
HA_SPIN_UNLOCK(PROTO_LOCK, &proto_lock);
|
HA_SPIN_UNLOCK(PROTO_LOCK, &proto_lock);
|
||||||
|
Loading…
Reference in New Issue
Block a user