diff options
author | Willy Tarreau <w@1wt.eu> | 2020-09-25 19:09:53 +0200 |
---|---|---|
committer | Willy Tarreau <w@1wt.eu> | 2020-10-07 19:35:30 +0200 |
commit | 4b81e9cfaf825d1ede997108cf983f64556d4414 (patch) | |
tree | 8e2571365da620e0e9bb257dfdd1ba3dc8198104 | |
parent | f4eb62954be9c3a3dcb79a94558968065dd96ada (diff) | |
download | haproxy-4b81e9cfaf825d1ede997108cf983f64556d4414.tar.gz |
MINOR: protocol: add a new pair of rx_enable/rx_disable methods
These methods will be used to enable/disable rx at the receiver level so
that callers don't play with FDs directly anymore. All our protocols use
the generic ones from sock.c at the moment. For now they're not used.
-rw-r--r-- | include/haproxy/protocol-t.h | 2 | ||||
-rw-r--r-- | src/proto_sockpair.c | 3 | ||||
-rw-r--r-- | src/proto_tcp.c | 4 | ||||
-rw-r--r-- | src/proto_udp.c | 4 | ||||
-rw-r--r-- | src/proto_uxst.c | 2 |
5 files changed, 15 insertions, 0 deletions
diff --git a/include/haproxy/protocol-t.h b/include/haproxy/protocol-t.h index 3d5ce82cd..fbd84193d 100644 --- a/include/haproxy/protocol-t.h +++ b/include/haproxy/protocol-t.h @@ -91,6 +91,8 @@ struct protocol { int (*listen)(struct listener *l, char *errmsg, int errlen); /* start a listener */ /* functions acting on the receiver */ + void (*rx_enable)(struct receiver *rx); /* enable receiving on the receiver */ + void (*rx_disable)(struct receiver *rx); /* disable receiving on the receiver */ int (*rx_suspend)(struct receiver *rx); /* temporarily suspend this receiver for a soft restart */ int (*rx_resume)(struct receiver *rx); /* try to resume a temporarily suspended receiver */ diff --git a/src/proto_sockpair.c b/src/proto_sockpair.c index b787f95fe..4a5701c8c 100644 --- a/src/proto_sockpair.c +++ b/src/proto_sockpair.c @@ -36,6 +36,7 @@ #include <haproxy/listener.h> #include <haproxy/protocol.h> #include <haproxy/proto_sockpair.h> +#include <haproxy/sock.h> #include <haproxy/time.h> #include <haproxy/tools.h> #include <haproxy/version.h> @@ -67,6 +68,8 @@ static struct protocol proto_sockpair = { .sock_prot = 0, .add = sockpair_add_listener, .listen = sockpair_bind_listener, + .rx_enable = sock_enable, + .rx_disable = sock_disable, .accept = &listener_accept, .connect = &sockpair_connect_server, .receivers = LIST_HEAD_INIT(proto_sockpair.receivers), diff --git a/src/proto_tcp.c b/src/proto_tcp.c index 81eda1428..ae0310d02 100644 --- a/src/proto_tcp.c +++ b/src/proto_tcp.c @@ -60,6 +60,8 @@ static struct protocol proto_tcpv4 = { .sock_prot = IPPROTO_TCP, .add = tcpv4_add_listener, .listen = tcp_bind_listener, + .rx_enable = sock_enable, + .rx_disable = sock_disable, .rx_suspend = tcp_suspend_receiver, .rx_resume = tcp_resume_receiver, .accept = &listener_accept, @@ -80,6 +82,8 @@ static struct protocol proto_tcpv6 = { .sock_prot = IPPROTO_TCP, .add = tcpv6_add_listener, .listen = tcp_bind_listener, + .rx_enable = sock_enable, + .rx_disable = sock_disable, .rx_suspend = tcp_suspend_receiver, .rx_resume = tcp_resume_receiver, .accept = &listener_accept, diff --git a/src/proto_udp.c b/src/proto_udp.c index 1181d1adc..31db44298 100644 --- a/src/proto_udp.c +++ b/src/proto_udp.c @@ -55,6 +55,8 @@ static struct protocol proto_udp4 = { .sock_prot = IPPROTO_UDP, .add = udp4_add_listener, .listen = udp_bind_listener, + .rx_enable = sock_enable, + .rx_disable = sock_disable, .rx_suspend = udp_suspend_receiver, .receivers = LIST_HEAD_INIT(proto_udp4.receivers), .nb_receivers = 0, @@ -72,6 +74,8 @@ static struct protocol proto_udp6 = { .sock_prot = IPPROTO_UDP, .add = udp6_add_listener, .listen = udp_bind_listener, + .rx_enable = sock_enable, + .rx_disable = sock_disable, .rx_suspend = udp_suspend_receiver, .receivers = LIST_HEAD_INIT(proto_udp6.receivers), .nb_receivers = 0, diff --git a/src/proto_uxst.c b/src/proto_uxst.c index 7278d51b3..1febe3e5e 100644 --- a/src/proto_uxst.c +++ b/src/proto_uxst.c @@ -55,6 +55,8 @@ static struct protocol proto_unix = { .sock_prot = 0, .add = uxst_add_listener, .listen = uxst_bind_listener, + .rx_enable = sock_enable, + .rx_disable = sock_disable, .rx_suspend = uxst_suspend_receiver, .accept = &listener_accept, .connect = &uxst_connect_server, |