]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: connection: move the CO_FL_WAIT_ROOM cleanup to the reader only
authorWilly Tarreau <w@1wt.eu>
Fri, 17 Jan 2020 08:59:40 +0000 (09:59 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 17 Jan 2020 16:19:27 +0000 (17:19 +0100)
CO_FL_WAIT_ROOM is set by the splicing function in raw_sock, and cleared
by the stream-int when splicing is disabled, as well as in
conn_refresh_polling_flags() so that a new call to ->rcv_pipe() could
be attempted by the I/O callbacks called from conn_fd_handler(). This
clearing in conn_refresh_polling_flags() makes no sense anymore and is
in no way related to the polling at all.

Since we don't call them from there anymore it's better to clear it
before attempting to receive, and to set it again later. So let's move
this operation where it should be, in raw_sock_to_pipe() so that it's
now symmetric. It was also placed in raw_sock_to_buf() so that we're
certain that it gets cleared if an attempt to splice is replaced with
a subsequent attempt to recv(). And these were currently already achieved
by the call to conn_refresh_polling_flags(). Now it could theorically be
removed from the stream-int.

include/proto/connection.h
src/raw_sock.c

index 001276de4efce5ba6e740e8c2bc6fa100f2d22a3..cd6e62d8d34f9bcb3c2f1579b99cc87c6fc76d0c 100644 (file)
@@ -178,7 +178,7 @@ static inline void conn_refresh_polling_flags(struct connection *conn)
        if (conn_ctrl_ready(conn) && !(conn->flags & CO_FL_WILL_UPDATE)) {
                unsigned int flags = conn->flags;
 
-               flags &= ~(CO_FL_CURR_RD_ENA | CO_FL_CURR_WR_ENA | CO_FL_WAIT_ROOM);
+               flags &= ~(CO_FL_CURR_RD_ENA | CO_FL_CURR_WR_ENA);
                if (fd_recv_active(conn->handle.fd))
                        flags |= CO_FL_CURR_RD_ENA;
                if (fd_send_active(conn->handle.fd))
index 197d27d147ceed3f59dc6fb58de826f1978f01a7..63c8f6f48c521c1829b1d6372b7762d633102837 100644 (file)
@@ -72,6 +72,7 @@ int raw_sock_to_pipe(struct connection *conn, void *xprt_ctx, struct pipe *pipe,
        if (!fd_recv_ready(conn->handle.fd))
                return 0;
 
+       conn->flags &= ~CO_FL_WAIT_ROOM;
        conn_refresh_polling_flags(conn);
        errno = 0;
 
@@ -239,6 +240,7 @@ static size_t raw_sock_to_buf(struct connection *conn, void *xprt_ctx, struct bu
        if (!fd_recv_ready(conn->handle.fd))
                return 0;
 
+       conn->flags &= ~CO_FL_WAIT_ROOM;
        conn_refresh_polling_flags(conn);
        errno = 0;