struct mt_list mt_list;
};
+/* Status of the connection/mux layer. This defines how to handle app data.
+ *
+ * During a standard quic_conn lifetime it transitions like this :
+ * QC_MUX_NULL -> QC_MUX_READY -> QC_MUX_RELEASED
+ */
+enum qc_mux_state {
+ QC_MUX_NULL, /* not allocated, data should be buffered */
+ QC_MUX_READY, /* allocated, ready to handle data */
+ QC_MUX_RELEASED, /* released, data can be dropped */
+};
+
/* The number of buffers for outgoing packets (must be a power of two). */
#define QUIC_CONN_TX_BUFS_NB 8
#define QUIC_CONN_TX_BUF_SZ QUIC_PACKET_MAXLEN
/* Thread ID this connection is attached to */
int tid;
int state;
+ enum qc_mux_state mux_state; /* status of the connection/mux layer */
uint64_t err_code;
unsigned char enc_params[QUIC_TP_MAX_ENCLEN]; /* encoded QUIC transport parameters */
size_t enc_params_len;
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;
}
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;
}
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
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;