]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: stconn: always use se_fl_set_error() to set the pending error
authorWilly Tarreau <w@1wt.eu>
Tue, 17 Jan 2023 15:25:29 +0000 (16:25 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 17 Jan 2023 15:25:29 +0000 (16:25 +0100)
In mux-h2 and mux-quic we still had two places manually setting
SE_FL_ERR_PENDING or SE_FL_ERROR depending on the EOS state, instead
of using se_fl_set_error() which takes care of the condition. Better
use the specialized function for this, it will allow to centralize
the conditions. Note that this will be needed to fix a bug.

src/mux_h2.c
src/mux_quic.c

index ffbde461936709cbd197c0363bd88b1ecf35aced..a781cb0167c302ebcbc0ac484fbeec169402606e 100644 (file)
@@ -6477,10 +6477,7 @@ static size_t h2_snd_buf(struct stconn *sc, struct buffer *buf, size_t count, in
            !b_data(&h2s->h2c->dbuf) &&
            (h2s->flags & (H2_SF_BLK_SFCTL | H2_SF_BLK_MFCTL))) {
                TRACE_DEVEL("fctl with shutr, reporting error to app-layer", H2_EV_H2S_SEND|H2_EV_STRM_SEND|H2_EV_STRM_ERR, h2s->h2c->conn, h2s);
-               if (se_fl_test(h2s->sd, SE_FL_EOS))
-                       se_fl_set(h2s->sd, SE_FL_ERROR);
-               else
-                       se_fl_set(h2s->sd, SE_FL_ERR_PENDING);
+               se_fl_set_error(h2s->sd);
        }
 
        if (total > 0 && !(h2s->flags & H2_SF_BLK_SFCTL) &&
index 71aae7165c9c40f6ecd6ea59a8337c84f729af34..31d5a3ab04751088d833a50831ad3109775093a7 100644 (file)
@@ -2394,10 +2394,7 @@ static int qc_wake_some_streams(struct qcc *qcc)
                        continue;
 
                if (qcc->conn->flags & CO_FL_ERROR) {
-                       se_fl_set(qcs->sd, SE_FL_ERR_PENDING);
-                       if (se_fl_test(qcs->sd, SE_FL_EOS))
-                               se_fl_set(qcs->sd, SE_FL_ERROR);
-
+                       se_fl_set_error(qcs->sd);
                        qcs_alert(qcs);
                }
        }