mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 06:11:32 +02:00
MINOR: stream-int: use si_cant_put() instead of setting SI_FL_WAIT_ROOM
We now do this on the si_cs_recv() path so that we always have SI_FL_WANT_PUT properly set when there's a need to receive and SI_FL_WAIT_ROOM upon failure.
This commit is contained in:
parent
394970c297
commit
af4f6f6d2f
@ -330,7 +330,7 @@ static inline int si_alloc_ibuf(struct stream_interface *si, struct buffer_wait
|
|||||||
si->flags &= ~SI_FL_WAIT_ROOM;
|
si->flags &= ~SI_FL_WAIT_ROOM;
|
||||||
ret = channel_alloc_buffer(si_ic(si), wait);
|
ret = channel_alloc_buffer(si_ic(si), wait);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
si->flags |= SI_FL_WAIT_ROOM;
|
si_cant_put(si);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -756,7 +756,7 @@ void stream_int_update(struct stream_interface *si)
|
|||||||
/* stop reading */
|
/* stop reading */
|
||||||
if (!(si->flags & SI_FL_WAIT_ROOM)) {
|
if (!(si->flags & SI_FL_WAIT_ROOM)) {
|
||||||
if (!(ic->flags & CF_DONT_READ)) /* full */
|
if (!(ic->flags & CF_DONT_READ)) /* full */
|
||||||
si->flags |= SI_FL_WAIT_ROOM;
|
si_cant_put(si);
|
||||||
ic->rex = TICK_ETERNITY;
|
ic->rex = TICK_ETERNITY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1098,6 +1098,9 @@ int si_cs_recv(struct conn_stream *cs)
|
|||||||
if (si->wait_event.wait_reason & SUB_CAN_RECV)
|
if (si->wait_event.wait_reason & SUB_CAN_RECV)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
/* by default nothing to deliver */
|
||||||
|
si_stop_put(si);
|
||||||
|
|
||||||
/* maybe we were called immediately after an asynchronous shutr */
|
/* maybe we were called immediately after an asynchronous shutr */
|
||||||
if (ic->flags & CF_SHUTR)
|
if (ic->flags & CF_SHUTR)
|
||||||
return 1;
|
return 1;
|
||||||
@ -1165,7 +1168,7 @@ int si_cs_recv(struct conn_stream *cs)
|
|||||||
/* the pipe is full or we have read enough data that it
|
/* the pipe is full or we have read enough data that it
|
||||||
* could soon be full. Let's stop before needing to poll.
|
* could soon be full. Let's stop before needing to poll.
|
||||||
*/
|
*/
|
||||||
si->flags |= SI_FL_WAIT_ROOM;
|
si_cant_put(si);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* splice not possible (anymore), let's go on on standard copy */
|
/* splice not possible (anymore), let's go on on standard copy */
|
||||||
@ -1191,13 +1194,13 @@ int si_cs_recv(struct conn_stream *cs)
|
|||||||
max = channel_recv_max(ic);
|
max = channel_recv_max(ic);
|
||||||
|
|
||||||
if (!max) {
|
if (!max) {
|
||||||
si->flags |= SI_FL_WAIT_ROOM;
|
si_cant_put(si);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = cs->conn->mux->rcv_buf(cs, &ic->buf, max, co_data(ic) ? CO_RFL_BUF_WET : 0);
|
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)
|
if (cs->flags & CS_FL_RCV_MORE)
|
||||||
si->flags |= SI_FL_WAIT_ROOM;
|
si_cant_put(si);
|
||||||
|
|
||||||
if (ret <= 0)
|
if (ret <= 0)
|
||||||
break;
|
break;
|
||||||
@ -1219,7 +1222,7 @@ int si_cs_recv(struct conn_stream *cs)
|
|||||||
ic->total += ret;
|
ic->total += ret;
|
||||||
|
|
||||||
if (!channel_may_recv(ic)) {
|
if (!channel_may_recv(ic)) {
|
||||||
si->flags |= SI_FL_WAIT_ROOM;
|
si_cant_put(si);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user