]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: mux-quic: report error on stream-endpoint earlier
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 24 May 2023 12:43:43 +0000 (14:43 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 24 May 2023 12:46:52 +0000 (14:46 +0200)
A RESET_STREAM is emitted in several occasions :
- protocol error during HTTP/3.0 parsing
- STOP_SENDING reception

In both cases, if a stream-endpoint is attached we must set its ERR
flag. This was correctly done but after some delay as it was only when
the RESET_STREAM was emitted. Change this to set the ERR flag as soon as
one of the upper cases has been encountered. This should help to release
faster streams in error.

This should be backported up to 2.7.

src/mux_quic.c

index 99cb37f0662f5d7c65b186640a058f1488da4257..7c74bc4ad291c45e16baf708324c8af3af8a3616 100644 (file)
@@ -883,6 +883,13 @@ static int qcc_decode_qcs(struct qcc *qcc, struct qcs *qcs)
                        TRACE_ERROR("decoding error", QMUX_EV_QCS_RECV, qcc->conn, qcs);
                        goto err;
                }
+
+               if (qcs->flags & QC_SF_TO_RESET) {
+                       if (qcs_sc(qcs) && !se_fl_test(qcs->sd, SE_FL_ERROR|SE_FL_ERR_PENDING)) {
+                               se_fl_set_error(qcs->sd);
+                               qcs_alert(qcs);
+                       }
+               }
        }
        else {
                TRACE_DATA("ignore read on stream", QMUX_EV_QCS_RECV, qcc->conn, qcs);
@@ -1398,6 +1405,12 @@ int qcc_recv_stop_sending(struct qcc *qcc, uint64_t id, uint64_t err)
         */
        qcc_reset_stream(qcs, err);
 
+       /* Report send error to stream-endpoint layer. */
+       if (qcs_sc(qcs)) {
+               se_fl_set_error(qcs->sd);
+               qcs_alert(qcs);
+       }
+
        if (qcc_may_expire(qcc) && !qcc->nb_hreq)
                qcc_refresh_timeout(qcc);
 
@@ -1816,11 +1829,6 @@ static int qcs_send_reset(struct qcs *qcs)
                return 1;
        }
 
-       if (qcs_sc(qcs)) {
-               se_fl_set_error(qcs->sd);
-               qcs_alert(qcs);
-       }
-
        qcs_close_local(qcs);
        qcs->flags &= ~QC_SF_TO_RESET;