]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: conn-stream: Force mux to wait for read events if abortonclose is set
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 8 Apr 2021 16:13:25 +0000 (18:13 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 6 May 2021 07:19:05 +0000 (09:19 +0200)
When the abortonclose option is enabled, to be sure to be immediately
notified when a shutdown is received from the client, the frontend
conn-stream must be sure the mux will wait for read events. To do so, the
CO_RFL_KEEP_RECV flag is set when mux->rcv_buf() is called. This new flag
instructs the mux to wait for read events, regardless its internal state.

This patch is required to fix abortonclose option for H1 client connections.

include/haproxy/connection-t.h
src/stream_interface.c

index 7cac07a69da81ed5b3b673e75bc687d3a62670f5..857963264443a954a27ed7b623a076a4ec53d141 100644 (file)
@@ -273,6 +273,7 @@ enum {
        CO_RFL_BUF_WET     = 0x0001,    /* Buffer still has some output data present */
        CO_RFL_BUF_FLUSH   = 0x0002,    /* Flush mux's buffers but don't read more data */
        CO_RFL_READ_ONCE   = 0x0004,    /* don't loop even if the request/response is small */
+       CO_RFL_KEEP_RECV   = 0x0008,    /* Instruct the mux to still wait for read events  */
 };
 
 /* flags that can be passed to xprt->snd_buf() and mux->snd_buf() */
index 0f01d0b676c0e83bf8b63c0c66dc1be6abf91c0c..43f1a88637741293dfeaa7ac1556a5297893fb6d 100644 (file)
@@ -1321,6 +1321,7 @@ int si_cs_recv(struct conn_stream *cs)
                 * CS_FL_RCV_MORE on the CS if more space is needed.
                 */
                max = channel_recv_max(ic);
+               flags |= ((!conn_is_back(conn) && (si_strm(si)->be->options & PR_O_ABRT_CLOSE)) ? CO_RFL_KEEP_RECV : 0);
                ret = cs->conn->mux->rcv_buf(cs, &ic->buf, max, flags | (co_data(ic) ? CO_RFL_BUF_WET : 0));
 
                if (cs->flags & CS_FL_WANT_ROOM)