mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-02-17 02:56:51 +00:00
MEDIUM: listeners: make use of fd_want_recv_safe() to enable early receivers
We used to refrain from calling fd_want_recv() if fd_updt was not allocated but it's not the right solution as this does not allow the FD to be set. Instead, let's use the new fd_want_recv_safe() which will update the FD and create an update entry only if possible. In addition, the equivalent test before calling fd_stop_recv() was removed as totally useless since there's not fd_updt creation in this case.
This commit is contained in:
parent
7e98e28eb0
commit
a4380b211f
@ -107,20 +107,18 @@ static void sockpair_add_listener(struct listener *listener, int port)
|
||||
}
|
||||
|
||||
/* Enable receipt of incoming connections for listener <l>. The receiver must
|
||||
* still be valid. Does nothing in early boot (needs fd_updt).
|
||||
* still be valid.
|
||||
*/
|
||||
static void sockpair_enable_listener(struct listener *l)
|
||||
{
|
||||
if (fd_updt)
|
||||
fd_want_recv(l->rx.fd);
|
||||
fd_want_recv_safe(l->rx.fd);
|
||||
}
|
||||
|
||||
/* Disable receipt of incoming connections for listener <l>. The receiver must
|
||||
* still be valid. Does nothing in early boot (needs fd_updt).
|
||||
* still be valid.
|
||||
*/
|
||||
static void sockpair_disable_listener(struct listener *l)
|
||||
{
|
||||
if (fd_updt)
|
||||
fd_stop_recv(l->rx.fd);
|
||||
}
|
||||
|
||||
|
@ -749,20 +749,18 @@ static void tcpv6_add_listener(struct listener *listener, int port)
|
||||
}
|
||||
|
||||
/* Enable receipt of incoming connections for listener <l>. The receiver must
|
||||
* still be valid. Does nothing in early boot (needs fd_updt).
|
||||
* still be valid.
|
||||
*/
|
||||
static void tcp_enable_listener(struct listener *l)
|
||||
{
|
||||
if (fd_updt)
|
||||
fd_want_recv(l->rx.fd);
|
||||
fd_want_recv_safe(l->rx.fd);
|
||||
}
|
||||
|
||||
/* Disable receipt of incoming connections for listener <l>. The receiver must
|
||||
* still be valid. Does nothing in early boot (needs fd_updt).
|
||||
* still be valid.
|
||||
*/
|
||||
static void tcp_disable_listener(struct listener *l)
|
||||
{
|
||||
if (fd_updt)
|
||||
fd_stop_recv(l->rx.fd);
|
||||
}
|
||||
|
||||
|
@ -173,20 +173,18 @@ static void udp6_add_listener(struct listener *listener, int port)
|
||||
}
|
||||
|
||||
/* Enable receipt of incoming connections for listener <l>. The receiver must
|
||||
* still be valid. Does nothing in early boot (needs fd_updt).
|
||||
* still be valid.
|
||||
*/
|
||||
static void udp_enable_listener(struct listener *l)
|
||||
{
|
||||
if (fd_updt)
|
||||
fd_want_recv(l->rx.fd);
|
||||
fd_want_recv_safe(l->rx.fd);
|
||||
}
|
||||
|
||||
/* Disable receipt of incoming connections for listener <l>. The receiver must
|
||||
* still be valid. Does nothing in early boot (needs fd_updt).
|
||||
* still be valid.
|
||||
*/
|
||||
static void udp_disable_listener(struct listener *l)
|
||||
{
|
||||
if (fd_updt)
|
||||
fd_stop_recv(l->rx.fd);
|
||||
}
|
||||
|
||||
|
@ -153,20 +153,18 @@ static void uxst_add_listener(struct listener *listener, int port)
|
||||
}
|
||||
|
||||
/* Enable receipt of incoming connections for listener <l>. The receiver must
|
||||
* still be valid. Does nothing in early boot (needs fd_updt).
|
||||
* still be valid.
|
||||
*/
|
||||
static void uxst_enable_listener(struct listener *l)
|
||||
{
|
||||
if (fd_updt)
|
||||
fd_want_recv(l->rx.fd);
|
||||
fd_want_recv_safe(l->rx.fd);
|
||||
}
|
||||
|
||||
/* Disable receipt of incoming connections for listener <l>. The receiver must
|
||||
* still be valid. Does nothing in early boot (needs fd_updt).
|
||||
* still be valid.
|
||||
*/
|
||||
static void uxst_disable_listener(struct listener *l)
|
||||
{
|
||||
if (fd_updt)
|
||||
fd_stop_recv(l->rx.fd);
|
||||
}
|
||||
|
||||
|
14
src/sock.c
14
src/sock.c
@ -186,21 +186,17 @@ int sock_create_server_socket(struct connection *conn)
|
||||
return my_socketat(ns, conn->dst->ss_family, SOCK_STREAM, 0);
|
||||
}
|
||||
|
||||
/* Enables receiving on receiver <rx> once already bound. Does nothing in early
|
||||
* boot (needs fd_updt).
|
||||
*/
|
||||
/* Enables receiving on receiver <rx> once already bound. */
|
||||
void sock_enable(struct receiver *rx)
|
||||
{
|
||||
if (rx->flags & RX_F_BOUND && fd_updt)
|
||||
fd_want_recv(rx->fd);
|
||||
if (rx->flags & RX_F_BOUND)
|
||||
fd_want_recv_safe(rx->fd);
|
||||
}
|
||||
|
||||
/* Disables receiving on receiver <rx> once already bound. Does nothing in early
|
||||
* boot (needs fd_updt).
|
||||
*/
|
||||
/* Disables receiving on receiver <rx> once already bound. */
|
||||
void sock_disable(struct receiver *rx)
|
||||
{
|
||||
if (rx->flags & RX_F_BOUND && fd_updt)
|
||||
if (rx->flags & RX_F_BOUND)
|
||||
fd_stop_recv(rx->fd);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user