]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: stconn: rename cs_ep_set_error() to se_fl_set_error()
authorWilly Tarreau <w@1wt.eu>
Wed, 18 May 2022 16:15:18 +0000 (18:15 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 27 May 2022 17:33:34 +0000 (19:33 +0200)
First it applies to the stream endpoint and not the conn_stream, and
second it only tests and touches the flags so it makes sense to call
it se_fl_ like other functions which only manipulate the flags, as
it's just a special case of flags.

include/haproxy/conn_stream.h
src/mux_fcgi.c
src/mux_h2.c

index e3d2b71f79969b0aeb4b8213a2d205b6f718c287..5bfffd9c28003eb25ed37974e73e8e24039d7a9a 100644 (file)
@@ -92,6 +92,15 @@ static forceinline uint se_fl_get(const struct sedesc *se)
        return se->flags;
 }
 
+/* sets SE_FL_ERROR or SE_FL_ERR_PENDING on the endpoint */
+static inline void se_fl_set_error(struct sedesc *se)
+{
+       if (se_fl_test(se, SE_FL_EOS))
+               se_fl_set(se, SE_FL_ERROR);
+       else
+               se_fl_set(se, SE_FL_ERR_PENDING);
+}
+
 /* stream connector version */
 static forceinline void sc_ep_zero(struct stconn *sc)
 {
@@ -274,15 +283,6 @@ static inline void sc_conn_drain_and_shut(struct stconn *cs)
        sc_conn_shutr(cs, CO_SHR_DRAIN);
 }
 
-/* sets SE_FL_ERROR or SE_FL_ERR_PENDING on the endpoint */
-static inline void cs_ep_set_error(struct sedesc *endp)
-{
-       if (se_fl_test(endp, SE_FL_EOS))
-               se_fl_set(endp, SE_FL_ERROR);
-       else
-               se_fl_set(endp, SE_FL_ERR_PENDING);
-}
-
 /* Returns non-zero if the stream connector's Rx path is blocked */
 static inline int cs_rx_blocked(const struct stconn *cs)
 {
index 5bde48be27a8414a58a26118c786410dc0af6ee2..058ab3bc268c15a0786c88c1c40ad249f80708fa 100644 (file)
@@ -927,7 +927,7 @@ static inline void fcgi_strm_error(struct fcgi_strm *fstrm)
                        fstrm->state = FCGI_SS_ERROR;
                        TRACE_STATE("switching to ERROR", FCGI_EV_FSTRM_ERR, fstrm->fconn->conn, fstrm);
                }
-               cs_ep_set_error(fstrm->endp);
+               se_fl_set_error(fstrm->endp);
        }
 }
 
@@ -4120,7 +4120,7 @@ static size_t fcgi_snd_buf(struct stconn *cs, struct buffer *buf, size_t count,
 
        if (fstrm->state == FCGI_SS_ERROR) {
                TRACE_DEVEL("reporting error to the app-layer stream", FCGI_EV_STRM_SEND|FCGI_EV_FSTRM_ERR|FCGI_EV_STRM_ERR, fconn->conn, fstrm);
-               cs_ep_set_error(fstrm->endp);
+               se_fl_set_error(fstrm->endp);
                if (!(fstrm->flags & FCGI_SF_BEGIN_SENT) || fcgi_strm_send_abort(fconn, fstrm))
                        fcgi_strm_close(fstrm);
        }
index 4a3a701655a3ce5f801bb30150ef036a2e4c5881..1e50bed1b5a2450057d98d75adce7c4d956acce2 100644 (file)
@@ -1284,7 +1284,7 @@ static inline __maybe_unused void h2s_error(struct h2s *h2s, enum h2_err err)
                h2s->errcode = err;
                if (h2s->st < H2_SS_ERROR)
                        h2s->st = H2_SS_ERROR;
-               cs_ep_set_error(h2s->endp);
+               se_fl_set_error(h2s->endp);
        }
 }
 
@@ -2756,7 +2756,7 @@ static int h2c_handle_rst_stream(struct h2c *h2c, struct h2s *h2s)
        h2s_close(h2s);
 
        if (h2s_sc(h2s)) {
-               cs_ep_set_error(h2s->endp);
+               se_fl_set_error(h2s->endp);
                h2s_alert(h2s);
        }
 
@@ -6668,7 +6668,7 @@ static size_t h2_snd_buf(struct stconn *cs, struct buffer *buf, size_t count, in
        /* RST are sent similarly to frame acks */
        if (h2s->st == H2_SS_ERROR || h2s->flags & H2_SF_RST_RCVD) {
                TRACE_DEVEL("reporting RST/error to the app-layer stream", H2_EV_H2S_SEND|H2_EV_H2S_ERR|H2_EV_STRM_ERR, h2s->h2c->conn, h2s);
-               cs_ep_set_error(h2s->endp);
+               se_fl_set_error(h2s->endp);
                if (h2s_send_rst_stream(h2s->h2c, h2s) > 0)
                        h2s_close(h2s);
        }