BUG/MINOR: mux_pt: Set CS_FL_WANT_ROOM when count is zero in rcv_buf() callback
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.
diff --git a/src/mux_pt.c b/src/mux_pt.c
index 0a2b805..4d3303a 100644
--- a/src/mux_pt.c
+++ b/src/mux_pt.c
@@ -209,7 +209,7 @@
{
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 @@
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;