]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: mux_pt: Set CS_FL_WANT_ROOM when count is zero in rcv_buf() callback
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 17 Dec 2018 12:21:02 +0000 (13:21 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 17 Dec 2018 15:28:49 +0000 (16:28 +0100)
When count is zero in the function mux_pt_rcv_buf(), it means the channel's
buffer is full. So we need to set the CS_FL_WANT_ROOM on the
conn_stream. Otherwise, while the channel is full, we will try to receive in
loop more data.

src/mux_pt.c

index 0a2b805c3dc71e07f82526a667ea0272de48ed71..4d3303ac04abe1312f3a1518c90ade5c416f815f 100644 (file)
@@ -209,7 +209,7 @@ static void mux_pt_shutr(struct conn_stream *cs, enum cs_shr_mode mode)
 {
        if (cs->flags & CS_FL_SHR)
                return;
-       cs->flags &= ~CS_FL_RCV_MORE;
+       cs->flags &= ~(CS_FL_RCV_MORE | CS_FL_WANT_ROOM);
        if (conn_xprt_ready(cs->conn) && cs->conn->xprt->shutr)
                cs->conn->xprt->shutr(cs->conn, (mode == CS_SHR_DRAIN));
        if (cs->flags & CS_FL_SHW)
@@ -246,19 +246,19 @@ static size_t mux_pt_rcv_buf(struct conn_stream *cs, struct buffer *buf, size_t
        size_t ret;
 
        if (!count) {
-               cs->flags |= CS_FL_RCV_MORE;
+               cs->flags |= (CS_FL_RCV_MORE | CS_FL_WANT_ROOM);
                return 0;
        }
        b_realign_if_empty(buf);
        ret = cs->conn->xprt->rcv_buf(cs->conn, buf, count, flags);
        if (conn_xprt_read0_pending(cs->conn)) {
                if (ret == 0)
-                       cs->flags &= ~CS_FL_RCV_MORE;
+                       cs->flags &= ~(CS_FL_RCV_MORE | CS_FL_WANT_ROOM);
                cs->flags |= CS_FL_EOS;
        }
        if (cs->conn->flags & CO_FL_ERROR) {
                if (ret == 0)
-                       cs->flags &= ~CS_FL_RCV_MORE;
+                       cs->flags &= ~(CS_FL_RCV_MORE | CS_FL_WANT_ROOM);
                cs->flags |= CS_FL_ERROR;
        }
        return ret;