diff --git a/src/mux_pt.c b/src/mux_pt.c index beca8c2ea..4195ec250 100644 --- a/src/mux_pt.c +++ b/src/mux_pt.c @@ -116,6 +116,11 @@ 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; + return 0; + } + cs->flags &= ~CS_FL_RCV_MORE; ret = cs->conn->xprt->rcv_buf(cs->conn, buf, count, flags); if (conn_xprt_read0_pending(cs->conn)) cs->flags |= CS_FL_EOS; diff --git a/src/stream_interface.c b/src/stream_interface.c index 46fc9ebf1..65d2c6120 100644 --- a/src/stream_interface.c +++ b/src/stream_interface.c @@ -1226,13 +1226,11 @@ int si_cs_recv(struct conn_stream *cs) */ while (!(conn->flags & (CO_FL_ERROR | CO_FL_WAIT_ROOM | CO_FL_HANDSHAKE)) && !(cs->flags & (CS_FL_ERROR|CS_FL_EOS)) && !(ic->flags & CF_SHUTR)) { + /* 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); - if (!max) { - si_cant_put(si); - break; - } - ret = cs->conn->mux->rcv_buf(cs, &ic->buf, max, co_data(ic) ? CO_RFL_BUF_WET : 0); if (cs->flags & CS_FL_RCV_MORE) si_cant_put(si);