mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-21 22:01:31 +02:00
MINOR: mux-quic: adjust error code in init failure
If QUIC MUX cannot be initialized for any reason, the connection is shut down with a CONNECTION_CLOSE frame. Previously, no error code was explicitely specified, resulting in "no error" code. Change this by always set error code in case of QUIC MUX failure. Use the already defined QUIC MUX error code or "internal error" if unset. Call quic_set_connection_close() on error label to register it to the quic_conn layer. This should help to improve error reporting in case of MUX initialization failure.
This commit is contained in:
parent
bcade776c2
commit
403492af8e
@ -2552,6 +2552,7 @@ static int qmux_init(struct connection *conn, struct proxy *prx,
|
|||||||
conn->ctx = qcc;
|
conn->ctx = qcc;
|
||||||
qcc->nb_hreq = qcc->nb_sc = 0;
|
qcc->nb_hreq = qcc->nb_sc = 0;
|
||||||
qcc->flags = 0;
|
qcc->flags = 0;
|
||||||
|
qcc->err = quic_err_transport(QC_ERR_NO_ERROR);
|
||||||
|
|
||||||
/* Server parameters, params used for RX flow control. */
|
/* Server parameters, params used for RX flow control. */
|
||||||
lparams = &conn->handle.qc->rx.params;
|
lparams = &conn->handle.qc->rx.params;
|
||||||
@ -2635,7 +2636,7 @@ static int qmux_init(struct connection *conn, struct proxy *prx,
|
|||||||
if (qcc_install_app_ops(qcc, conn->handle.qc->app_ops)) {
|
if (qcc_install_app_ops(qcc, conn->handle.qc->app_ops)) {
|
||||||
TRACE_PROTO("Cannot install app layer", QMUX_EV_QCC_NEW|QMUX_EV_QCC_ERR, conn);
|
TRACE_PROTO("Cannot install app layer", QMUX_EV_QCC_NEW|QMUX_EV_QCC_ERR, conn);
|
||||||
/* prepare a CONNECTION_CLOSE frame */
|
/* prepare a CONNECTION_CLOSE frame */
|
||||||
quic_set_connection_close(conn->handle.qc, quic_err_transport(QC_ERR_APPLICATION_ERROR));
|
qcc_set_error(qcc, QC_ERR_APPLICATION_ERROR, 0);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2653,6 +2654,13 @@ static int qmux_init(struct connection *conn, struct proxy *prx,
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err:
|
err:
|
||||||
|
/* Prepare CONNECTION_CLOSE, using INTERNAL_ERROR as fallback code if unset. */
|
||||||
|
if (!(conn->handle.qc->flags & QUIC_FL_CONN_IMMEDIATE_CLOSE)) {
|
||||||
|
struct quic_err err = qcc && qcc->err.code ?
|
||||||
|
qcc->err : quic_err_transport(QC_ERR_INTERNAL_ERROR);
|
||||||
|
quic_set_connection_close(conn->handle.qc, err);
|
||||||
|
}
|
||||||
|
|
||||||
if (qcc) {
|
if (qcc) {
|
||||||
/* In case of MUX init failure, session will ensure connection is freed. */
|
/* In case of MUX init failure, session will ensure connection is freed. */
|
||||||
qcc->conn = NULL;
|
qcc->conn = NULL;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user