MINOR: mux-quic: close connection asap on local error

With the change for QUIC MUX local error API, the new flag QC_CF_ERRL is
now checked on qc_detach(). If set, qcs instance is freed even though
transfer is not finished. This should help to quickly release qcs and
eventually all MUX instance resources.

To further accelerate this, a specific check has been added in
qc_shutw(). It is skipped if local error flag is set to prevent noisy
reset stream invocation. In the same way, QUIC MUX is not rescheduled on
qc_recv_buf() operation if local error flag set.

This should be backported up to 2.7.
This commit is contained in:
Amaury Denoyelle 2023-05-03 18:17:19 +02:00
parent 35542ce7bf
commit d4af04198b

View File

@ -2534,7 +2534,8 @@ static void qc_detach(struct sedesc *sd)
qcc_rm_sc(qcc);
if (!qcs_is_close_local(qcs) && !(qcc->conn->flags & CO_FL_ERROR)) {
if (!qcs_is_close_local(qcs) && !(qcc->conn->flags & CO_FL_ERROR) &&
!(qcc->flags & QC_CF_ERRL)) {
TRACE_STATE("remaining data, detaching qcs", QMUX_EV_STRM_END, qcc->conn, qcs);
qcs->flags |= QC_SF_DETACH;
qcc_refresh_timeout(qcc);
@ -2611,7 +2612,8 @@ static size_t qc_recv_buf(struct stconn *sc, struct buffer *buf,
BUG_ON(!ncb_data(&qcs->rx.ncbuf, 0));
qcs->flags &= ~QC_SF_DEM_FULL;
tasklet_wakeup(qcs->qcc->wait_event.tasklet);
if (!(qcs->qcc->flags & QC_CF_ERRL))
tasklet_wakeup(qcs->qcc->wait_event.tasklet);
}
TRACE_LEAVE(QMUX_EV_STRM_RECV, qcs->qcc->conn, qcs);
@ -2726,6 +2728,11 @@ static void qc_shutw(struct stconn *sc, enum co_shw_mode mode)
TRACE_ENTER(QMUX_EV_STRM_SHUT, qcc->conn, qcs);
if (qcc->flags & QC_CF_ERRL) {
TRACE_DEVEL("connection on error", QMUX_EV_QCC_END, qcc->conn);
goto out;
}
/* Early closure reported if QC_SF_FIN_STREAM not yet set. */
if (!qcs_is_close_local(qcs) &&
!(qcs->flags & (QC_SF_FIN_STREAM|QC_SF_TO_RESET))) {
@ -2745,6 +2752,7 @@ static void qc_shutw(struct stconn *sc, enum co_shw_mode mode)
tasklet_wakeup(qcc->wait_event.tasklet);
}
out:
TRACE_LEAVE(QMUX_EV_STRM_SHUT, qcc->conn, qcs);
}