]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: stconn: always rely on CF_SHUTR in addition to cs_rx_blocked()
authorWilly Tarreau <w@1wt.eu>
Tue, 24 May 2022 14:18:11 +0000 (16:18 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 27 May 2022 17:33:35 +0000 (19:33 +0200)
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.

include/haproxy/cs_utils.h
src/conn_stream.c
src/stream.c

index 10a03a8f5790bb79e6be11860aa13a643914bc4a..a26011be3187f99b1198c1b74fad432e7fbf11f6 100644 (file)
@@ -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;
 
index 3d68625ec5521febd3b42192a065f0fd9f61cadb..c27a0ad64fe4737e5866eb5d7ba8a6e200e81400 100644 (file)
@@ -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;
 }
index e6b197897c2821940ed15acaf16b955460c2f36f..606a8681b767986d76bdf906d7758eb17426e01e 100644 (file)
@@ -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));
        }
 }