From 07968dcea35fd3a71f9f748e7a1f6c4c73fb7fe8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fr=C3=A9d=C3=A9ric=20L=C3=A9caille?= Date: Fri, 20 May 2022 20:53:20 +0200 Subject: [PATCH] BUG/MINOR: quic: Missing stats counter decrementation When we receive a CONNECTION_CLOSE frame, we should decrement this counter if the handshake state was not successful and if we have not received a TLS alert from the TLS stack. --- src/xprt_quic.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/xprt_quic.c b/src/xprt_quic.c index 4a56e1eee5..1341dc91f5 100644 --- a/src/xprt_quic.c +++ b/src/xprt_quic.c @@ -2626,6 +2626,13 @@ static int qc_parse_pkt_frms(struct quic_rx_packet *pkt, struct ssl_sock_ctx *ct case QUIC_FT_CONNECTION_CLOSE: case QUIC_FT_CONNECTION_CLOSE_APP: if (!(qc->flags & QUIC_FL_CONN_DRAINING)) { + /* If the connection did not reached the handshake complete state, + * the counter was not decremented. Note that if + * a TLS alert was received from the TLS stack, this counter + * has already been decremented. + */ + if (qc->state < QUIC_HS_ST_COMPLETE && !(qc->flags & QUIC_FL_CONN_TLS_ALERT)) + HA_ATOMIC_DEC(&qc->prx_counters->conn_opening); TRACE_PROTO("Entering draining state", QUIC_EV_CONN_PRSHPKT, qc); /* RFC 9000 10.2. Immediate Close: * The closing and draining connection states exist to ensure -- 2.47.3