From: Willy Tarreau Date: Tue, 17 Jan 2023 15:25:29 +0000 (+0100) Subject: CLEANUP: stconn: always use se_fl_set_error() to set the pending error X-Git-Tag: v2.8-dev2~31 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=35c4dd0005a210597c2b96317c6f69e3fed4b171;p=thirdparty%2Fhaproxy.git CLEANUP: stconn: always use se_fl_set_error() to set the pending error 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. --- diff --git a/src/mux_h2.c b/src/mux_h2.c index ffbde46193..a781cb0167 100644 --- a/src/mux_h2.c +++ b/src/mux_h2.c @@ -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) && diff --git a/src/mux_quic.c b/src/mux_quic.c index 71aae7165c..31d5a3ab04 100644 --- a/src/mux_quic.c +++ b/src/mux_quic.c @@ -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); } }