MINOR: mux_quic: reset stream after app shutdown for HTTP/0.9

HTTP/3 implements a GOAWAY frame for graceful shutdown. This allows to
reject any new stream opening with a larger ID. This is implemented via
HTTP/3 attach() callback called by qcs_new().

When HTTP/0.9 is used, there is no similar mechanism. This renders some
feature such as server max-reuse difficult to implement. This patch now
provides a method for such protocols with no graceful shutdown support.
Instead of invoking attach() callback, a stream is now immediately
resetted if the application protocol layer is already closed.

This patch does not change the behavior for HTTP/3. Only limited
protocols (currently only HTTP/0.9) without graceful shutdown are
impacted. These protocols are identified as their shutdown() callback is
nul.

This change is only necessary for HTTP/0.9 as there is no equivalent of
HTTP/3 GOAWAY in this case.
This commit is contained in:
Amaury Denoyelle 2026-04-22 09:28:24 +02:00
parent b71a0e7874
commit af49294633

View File

@ -223,7 +223,16 @@ static struct qcs *qcs_new(struct qcc *qcc, uint64_t id, enum qcs_type type)
}
}
if (qcc->app_ops->attach && qcc->app_ops->attach(qcs, qcc->ctx)) {
/* If app layer is closed, reset immediately a new stream if proto does
* not implement graceful shutdown. Else proto is responsible to either
* accept or reject the new stream via its attach() operation.
*/
if (qcc->app_st >= QCC_APP_ST_SHUT && !qcc->app_ops->shutdown) {
qcc_abort_stream_read(qcs);
qcc_reset_stream(qcs, 0, 0);
goto out;
}
else if (qcc->app_ops->attach && qcc->app_ops->attach(qcs, qcc->ctx)) {
TRACE_ERROR("app proto failure", QMUX_EV_QCS_NEW, qcc->conn, qcs);
goto err;
}