MINOR: quic: notify the mux on CONNECTION_CLOSE
The xprt layer is reponsible to notify the mux of a CONNECTION_CLOSE
reception. In this case the flag QC_CF_CC_RECV is positionned on the
qcc and the mux tasklet is waken up.
One of the notable effect of the QC_CF_CC_RECV is that each qcs will be
released even if they have remaining data in their send buffers.
diff --git a/include/haproxy/mux_quic-t.h b/include/haproxy/mux_quic-t.h
index f41918d..eb3d6e9 100644
--- a/include/haproxy/mux_quic-t.h
+++ b/include/haproxy/mux_quic-t.h
@@ -22,9 +22,11 @@
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 9111901..89d7875 100644
--- a/src/mux_quic.c
+++ b/src/mux_quic.c
@@ -275,7 +275,8 @@
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 @@
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 250c2b8..6556f77 100644
--- a/src/xprt_quic.c
+++ b/src/xprt_quic.c
@@ -2326,7 +2326,9 @@
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))