]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: mux-h2/mux-fcgi: Fully rely on CS_EP_KILL_CONN
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 30 Mar 2022 12:48:10 +0000 (14:48 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 13 Apr 2022 13:10:14 +0000 (15:10 +0200)
Instead of using a internal flag to kill the connection with the stream, we
now fully rely on CS_EP_KILL_CONN flag.

src/mux_fcgi.c
src/mux_h2.c

index 6e993933ca5e41ef4d63c3fd7f0ee0b35da0e813..6133c7e5479348cb812607c0ceb523dbee905fe4 100644 (file)
@@ -150,7 +150,6 @@ enum fcgi_strm_st {
 
 #define FCGI_SF_WANT_SHUTR     0x00001000  /* a stream couldn't shutr() (mux full/busy) */
 #define FCGI_SF_WANT_SHUTW     0x00002000  /* a stream couldn't shutw() (mux full/busy) */
-#define FCGI_SF_KILL_CONN      0x00004000  /* kill the whole connection with this stream */
 
 
 /* FCGI stream descriptor */
@@ -3724,7 +3723,7 @@ static void fcgi_do_shutr(struct fcgi_strm *fstrm)
         * for example because of a "tcp-request content reject" rule that is
         * normally used to limit abuse.
         */
-       if ((fstrm->flags & FCGI_SF_KILL_CONN) &&
+       if ((fstrm->endp->flags & CS_EP_KILL_CONN) &&
            !(fconn->flags & (FCGI_CF_ABRTS_SENT|FCGI_CF_ABRTS_FAILED))) {
                TRACE_STATE("stream wants to kill the connection", FCGI_EV_STRM_SHUT, fconn->conn, fstrm);
                fconn->state = FCGI_CS_CLOSED;
@@ -3785,7 +3784,7 @@ static void fcgi_do_shutw(struct fcgi_strm *fstrm)
                 * for example because of a "tcp-request content reject" rule that is
                 * normally used to limit abuse.
                 */
-               if ((fstrm->flags & FCGI_SF_KILL_CONN) &&
+               if ((fstrm->endp->flags & CS_EP_KILL_CONN) &&
                    !(fconn->flags & (FCGI_CF_ABRTS_SENT|FCGI_CF_ABRTS_FAILED))) {
                        TRACE_STATE("stream wants to kill the connection", FCGI_EV_STRM_SHUT, fconn->conn, fstrm);
                        fconn->state = FCGI_CS_CLOSED;
@@ -3860,12 +3859,8 @@ static void fcgi_shutr(struct conn_stream *cs, enum cs_shr_mode mode)
        struct fcgi_strm *fstrm = __cs_mux(cs);
 
        TRACE_POINT(FCGI_EV_STRM_SHUT, fstrm->fconn->conn, fstrm);
-       if (cs->endp->flags & CS_EP_KILL_CONN)
-               fstrm->flags |= FCGI_SF_KILL_CONN;
-
        if (!mode)
                return;
-
        fcgi_do_shutr(fstrm);
 }
 
@@ -3875,9 +3870,6 @@ static void fcgi_shutw(struct conn_stream *cs, enum cs_shw_mode mode)
        struct fcgi_strm *fstrm = __cs_mux(cs);
 
        TRACE_POINT(FCGI_EV_STRM_SHUT, fstrm->fconn->conn, fstrm);
-       if (cs->endp->flags & CS_EP_KILL_CONN)
-               fstrm->flags |= FCGI_SF_KILL_CONN;
-
        fcgi_do_shutw(fstrm);
 }
 
index 37f86bc7739a1f57fea975fde904b3bdd523794d..4bd652e8ff1dba6566a7add4cae6f077dac4233c 100644 (file)
@@ -202,7 +202,6 @@ enum h2_ss {
 
 #define H2_SF_WANT_SHUTR        0x00008000  // a stream couldn't shutr() (mux full/busy)
 #define H2_SF_WANT_SHUTW        0x00010000  // a stream couldn't shutw() (mux full/busy)
-#define H2_SF_KILL_CONN         0x00020000  // kill the whole connection with this stream
 
 #define H2_SF_EXT_CONNECT_SENT  0x00040000  // rfc 8441 an Extended CONNECT has been sent
 #define H2_SF_EXT_CONNECT_RCVD  0x00080000  // rfc 8441 an Extended CONNECT has been received and parsed
@@ -4501,7 +4500,7 @@ static void h2_do_shutr(struct h2s *h2s)
         * normally used to limit abuse. In this case we schedule a goaway to
         * close the connection.
         */
-       if ((h2s->flags & H2_SF_KILL_CONN) &&
+       if ((h2s->endp->flags & CS_EP_KILL_CONN) &&
            !(h2c->flags & (H2_CF_GOAWAY_SENT|H2_CF_GOAWAY_FAILED))) {
                TRACE_STATE("stream wants to kill the connection", H2_EV_STRM_SHUT, h2c->conn, h2s);
                h2c_error(h2c, H2_ERR_ENHANCE_YOUR_CALM);
@@ -4579,7 +4578,7 @@ static void h2_do_shutw(struct h2s *h2s)
                 * normally used to limit abuse. In this case we schedule a goaway to
                 * close the connection.
                 */
-               if ((h2s->flags & H2_SF_KILL_CONN) &&
+               if ((h2s->endp->flags & CS_EP_KILL_CONN) &&
                    !(h2c->flags & (H2_CF_GOAWAY_SENT|H2_CF_GOAWAY_FAILED))) {
                        TRACE_STATE("stream wants to kill the connection", H2_EV_STRM_SHUT, h2c->conn, h2s);
                        h2c_error(h2c, H2_ERR_ENHANCE_YOUR_CALM);
@@ -4672,12 +4671,8 @@ static void h2_shutr(struct conn_stream *cs, enum cs_shr_mode mode)
        struct h2s *h2s = __cs_mux(cs);
 
        TRACE_ENTER(H2_EV_STRM_SHUT, h2s->h2c->conn, h2s);
-       if (cs->endp->flags & CS_EP_KILL_CONN)
-               h2s->flags |= H2_SF_KILL_CONN;
-
        if (mode)
                h2_do_shutr(h2s);
-
        TRACE_LEAVE(H2_EV_STRM_SHUT, h2s->h2c->conn, h2s);
 }
 
@@ -4687,9 +4682,6 @@ static void h2_shutw(struct conn_stream *cs, enum cs_shw_mode mode)
        struct h2s *h2s = __cs_mux(cs);
 
        TRACE_ENTER(H2_EV_STRM_SHUT, h2s->h2c->conn, h2s);
-       if (cs->endp->flags & CS_EP_KILL_CONN)
-               h2s->flags |= H2_SF_KILL_CONN;
-
        h2_do_shutw(h2s);
        TRACE_LEAVE(H2_EV_STRM_SHUT, h2s->h2c->conn, h2s);
 }