MINOR: mux-quic: report error on stream-endpoint earlier

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.
This commit is contained in:
Amaury Denoyelle 2023-05-24 14:43:43 +02:00
parent 37d78997ae
commit 152beeec34
1 changed files with 13 additions and 5 deletions

View 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); TRACE_ERROR("decoding error", QMUX_EV_QCS_RECV, qcc->conn, qcs);
goto err; 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 { else {
TRACE_DATA("ignore read on stream", QMUX_EV_QCS_RECV, qcc->conn, qcs); 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); 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) if (qcc_may_expire(qcc) && !qcc->nb_hreq)
qcc_refresh_timeout(qcc); qcc_refresh_timeout(qcc);
@ -1816,11 +1829,6 @@ static int qcs_send_reset(struct qcs *qcs)
return 1; return 1;
} }
if (qcs_sc(qcs)) {
se_fl_set_error(qcs->sd);
qcs_alert(qcs);
}
qcs_close_local(qcs); qcs_close_local(qcs);
qcs->flags &= ~QC_SF_TO_RESET; qcs->flags &= ~QC_SF_TO_RESET;