MEDIUM: stconn: always rely on CF_SHUTR in addition to cs_rx_blocked()

One flag (RXBLK_SHUT) is always set with CF_SHUTR, so in order to remove
it, we first need to make sure we always check for CF_SHUTR where
cs_rx_blocked() is being used.
This commit is contained in:
Willy Tarreau 2022-05-24 16:18:11 +02:00
parent 516621bbe6
commit e7866b1ff7
3 changed files with 11 additions and 5 deletions

@ -294,9 +294,14 @@ static inline void cs_shutw(struct stconn *cs)
*/
static inline void cs_chk_rcv(struct stconn *cs)
{
struct channel *ic = sc_ic(cs);
if (sc_ep_test(cs, SE_FL_RXBLK_CONN) && cs_state_in(cs_opposite(cs)->state, SC_SB_RDY|SC_SB_EST|SC_SB_DIS|SC_SB_CLO))
cs_rx_conn_rdy(cs);
if (ic->flags & CF_SHUTR)
return;
if (cs_rx_blocked(cs) || !cs_rx_endp_ready(cs))
return;

@ -1186,7 +1186,7 @@ static void cs_notify(struct stconn *cs)
cs_chk_rcv(cs);
cs_chk_rcv(cso);
if (cs_rx_blocked(cs)) {
if (ic->flags & CF_SHUTR || cs_rx_blocked(cs)) {
ic->rex = TICK_ETERNITY;
}
else if ((ic->flags & (CF_SHUTR|CF_READ_PARTIAL)) == CF_READ_PARTIAL) {
@ -1594,7 +1594,7 @@ static int sc_conn_recv(struct stconn *cs)
sc_conn_read0(cs);
ret = 1;
}
else if (!cs_rx_blocked(cs)) {
else if (!cs_rx_blocked(cs) && !(ic->flags & CF_SHUTR)) {
/* Subscribe to receive events if we're blocking on I/O */
conn->mux->subscribe(cs, SUB_RETRY_RECV, &cs->wait_event);
cs_rx_endp_done(cs);
@ -1946,7 +1946,8 @@ static int cs_applet_process(struct stconn *cs)
* appctx but in the case the task is not in runqueue we may have to
* wakeup the appctx immediately.
*/
if ((cs_rx_endp_ready(cs) && !cs_rx_blocked(cs)) || sc_is_send_allowed(cs))
if ((cs_rx_endp_ready(cs) && !cs_rx_blocked(cs) && !(ic->flags & CF_SHUTR)) ||
sc_is_send_allowed(cs))
appctx_wakeup(__sc_appctx(cs));
return 0;
}

@ -1543,11 +1543,11 @@ static void stream_update_both_cs(struct stream *s)
* handled at the latest moment.
*/
if (sc_appctx(scf)) {
if ((cs_rx_endp_ready(scf) && !cs_rx_blocked(scf)) || sc_is_send_allowed(scf))
if ((cs_rx_endp_ready(scf) && !cs_rx_blocked(scf) && !(req->flags & CF_SHUTR)) || sc_is_send_allowed(scf))
appctx_wakeup(__sc_appctx(scf));
}
if (sc_appctx(scb)) {
if ((cs_rx_endp_ready(scb) && !cs_rx_blocked(scb)) || sc_is_send_allowed(scb))
if ((cs_rx_endp_ready(scb) && !cs_rx_blocked(scb) && !(res->flags & CF_SHUTR)) || sc_is_send_allowed(scb))
appctx_wakeup(__sc_appctx(scb));
}
}