diff --git a/include/haproxy/mux_quic-t.h b/include/haproxy/mux_quic-t.h index f41918da9..eb3d6e902 100644 --- a/include/haproxy/mux_quic-t.h +++ b/include/haproxy/mux_quic-t.h @@ -22,9 +22,11 @@ enum qcs_type { QCS_MAX_TYPES }; +#define QC_CF_CC_RECV 0x00000001 + struct qcc { struct connection *conn; - uint32_t flags; + uint32_t flags; /* QC_CF_* */ struct { uint64_t max_streams; /* maximum number of concurrent streams */ diff --git a/src/mux_quic.c b/src/mux_quic.c index 9111901c4..89d7875e8 100644 --- a/src/mux_quic.c +++ b/src/mux_quic.c @@ -275,7 +275,8 @@ static int qc_release_detached_streams(struct qcc *qcc) node = eb64_next(node); if (qcs->flags & QC_SF_DETACH) { - if (!b_data(&qcs->tx.buf) && !b_data(&qcs->tx.xprt_buf)) { + if ((!b_data(&qcs->tx.buf) && !b_data(&qcs->tx.xprt_buf)) || + qcc->flags & QC_CF_CC_RECV) { qcs_destroy(qcs); release = 1; } @@ -360,7 +361,8 @@ static void qc_detach(struct conn_stream *cs) fprintf(stderr, "%s: leaving with tx.buf.data=%lu, tx.xprt_buf.data=%lu\n", __func__, b_data(&qcs->tx.buf), b_data(&qcs->tx.xprt_buf)); - if (b_data(&qcs->tx.buf) || b_data(&qcs->tx.xprt_buf)) { + if ((b_data(&qcs->tx.buf) || b_data(&qcs->tx.xprt_buf)) && + !(qcc->flags & QC_CF_CC_RECV)) { qcs->flags |= QC_SF_DETACH; return; } diff --git a/src/xprt_quic.c b/src/xprt_quic.c index 250c2b80a..6556f77fa 100644 --- a/src/xprt_quic.c +++ b/src/xprt_quic.c @@ -2326,7 +2326,9 @@ static int qc_parse_pkt_frms(struct quic_rx_packet *pkt, struct ssl_sock_ctx *ct break; case QUIC_FT_CONNECTION_CLOSE: case QUIC_FT_CONNECTION_CLOSE_APP: - /* TODO warn the mux to close the connection */ + /* warn the mux to close the connection */ + conn->qcc->flags |= QC_CF_CC_RECV; + tasklet_wakeup(conn->qcc->wait_event.tasklet); break; case QUIC_FT_HANDSHAKE_DONE: if (objt_listener(ctx->conn->target))