MINOR: stream-int: Set CO_RFL transient/persistent flags apart in si_cs_rcv()
In si_cs_recv(), some CO_RFL flags are set when the mux's .rcv_buf()
function is called. Some are persitent inside si_cs_recv() scope, some
others must be computed at each call to rcv_buf(). This patch takes care of
distinguishing them.
Among others, CO_RFL_KEEP_RECV is a persistent flag while CO_RFL_BUF_WET is
transient.
(cherry picked from commit 68a14db573dbcf1385ce1a70d5ca477768a61d4a)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
diff --git a/src/stream_interface.c b/src/stream_interface.c
index e5da8ea..23070ba 100644
--- a/src/stream_interface.c
+++ b/src/stream_interface.c
@@ -1336,6 +1336,10 @@
if (!si_alloc_ibuf(si, &(si_strm(si)->buffer_wait)))
goto end_recv;
+
+ /* Instruct the mux it must subscribed for read events */
+ flags |= ((!conn_is_back(conn) && (si_strm(si)->be->options & PR_O_ABRT_CLOSE)) ? CO_RFL_KEEP_RECV : 0);
+
/* Important note : if we're called with POLL_IN|POLL_HUP, it means the read polling
* was enabled, which implies that the recv buffer was not full. So we have a guarantee
* that if such an event is not handled above in splice, it will be handled here by
@@ -1344,12 +1348,17 @@
while ((cs->flags & CS_FL_RCV_MORE) ||
(!(conn->flags & (CO_FL_ERROR | CO_FL_HANDSHAKE)) &&
(!(cs->flags & (CS_FL_ERROR|CS_FL_EOS))) && !(ic->flags & CF_SHUTR))) {
+ int cur_flags = flags;
+
+ /* Compute transient CO_RFL_* flags */
+ if (co_data(ic))
+ cur_flags |= CO_RFL_BUF_WET;
+
/* <max> may be null. This is the mux responsibility to set
* 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));
+ ret = cs->conn->mux->rcv_buf(cs, &ic->buf, max, cur_flags);
if (cs->flags & CS_FL_WANT_ROOM) {
si_rx_room_blk(si);