MINOR: quic: handle app data according to mux/connection layer status
Define a new enum to represent the status of the mux/connection layer
above a quic_conn. This is important to know if it's possible to handle
application data, or if it should be buffered or dropped.
diff --git a/src/xprt_quic.c b/src/xprt_quic.c
index ec09170..3683350 100644
--- a/src/xprt_quic.c
+++ b/src/xprt_quic.c
@@ -1058,6 +1058,9 @@
if (app_ops->finalize)
app_ops->finalize(qc->qcc->ctx);
+ /* mux-quic can now be considered ready. */
+ qc->mux_state = QC_MUX_READY;
+
return 1;
}
@@ -3203,12 +3206,9 @@
if (!(qel->tls_ctx.rx.flags & QUIC_FL_TLS_SECRETS_SET))
return 0;
- /* do not decrypt application level until handshake completion */
- if (tel == QUIC_TLS_ENC_LEVEL_APP &&
- HA_ATOMIC_LOAD(&qc->state) < QUIC_HS_ST_COMPLETE) {
+ /* check if the connection layer is ready before using app level */
+ if (tel == QUIC_TLS_ENC_LEVEL_APP && qc->mux_state != QC_MUX_READY)
return 0;
- }
-
return 1;
}
@@ -3475,6 +3475,9 @@
qc->timer_task = NULL;
}
+ /* Next application data can be dropped. */
+ qc->mux_state = QC_MUX_RELEASED;
+
TRACE_LEAVE(QUIC_EV_CONN_CLOSE, qc);
/* TODO for now release the quic_conn on notification by the upper
@@ -3608,6 +3611,7 @@
memcpy(qc->dcid.data, dcid, dcid_len);
qc->dcid.len = dcid_len;
}
+ qc->mux_state = QC_MUX_NULL;
/* Initialize the output buffer */
qc->obuf.pos = qc->obuf.data;