MINOR: quic: Make the quic_conn be aware of the number of streams
This is required when the retransmitted frame types when the mux is released.
We add a counter for the number of streams which were opened or closed by the mux.
After the mux has been released, we can rely on this counter to know if the STREAM
frames are retransmitted ones or not.
diff --git a/include/haproxy/quic_stream.h b/include/haproxy/quic_stream.h
index 0550f4f..1107e86 100644
--- a/include/haproxy/quic_stream.h
+++ b/include/haproxy/quic_stream.h
@@ -3,11 +3,12 @@
#ifdef USE_QUIC
+#include <haproxy/mux_quic-t.h>
#include <haproxy/quic_stream-t.h>
struct quic_conn;
-struct qc_stream_desc *qc_stream_desc_new(uint64_t id, void *ctx,
+struct qc_stream_desc *qc_stream_desc_new(uint64_t id, enum qcs_type, void *ctx,
struct quic_conn *qc);
void qc_stream_desc_release(struct qc_stream_desc *stream);
int qc_stream_desc_ack(struct qc_stream_desc **stream, size_t offset, size_t len);
diff --git a/include/haproxy/xprt_quic-t.h b/include/haproxy/xprt_quic-t.h
index 91ff570..a983733 100644
--- a/include/haproxy/xprt_quic-t.h
+++ b/include/haproxy/xprt_quic-t.h
@@ -743,6 +743,10 @@
/* RX buffer */
struct buffer buf;
struct list pkt_list;
+ struct {
+ /* Number of open or closed streams */
+ uint64_t nb_streams;
+ } strms[QCS_MAX_TYPES];
} rx;
struct {
struct quic_tls_kp prv_rx;
diff --git a/src/mux_quic.c b/src/mux_quic.c
index db16ca0..e129df8 100644
--- a/src/mux_quic.c
+++ b/src/mux_quic.c
@@ -123,7 +123,7 @@
* TODO qc_stream_desc is only useful for Tx buffering. It should not
* be required for unidirectional remote streams.
*/
- qcs->stream = qc_stream_desc_new(id, qcs, qcc->conn->handle.qc);
+ qcs->stream = qc_stream_desc_new(id, type, qcs, qcc->conn->handle.qc);
if (!qcs->stream)
goto err;
diff --git a/src/quic_stream.c b/src/quic_stream.c
index bb96738..3a7aed1 100644
--- a/src/quic_stream.c
+++ b/src/quic_stream.c
@@ -20,7 +20,7 @@
*
* Returns the newly allocated instance on success or else NULL.
*/
-struct qc_stream_desc *qc_stream_desc_new(uint64_t id, void *ctx,
+struct qc_stream_desc *qc_stream_desc_new(uint64_t id, enum qcs_type type, void *ctx,
struct quic_conn *qc)
{
struct qc_stream_desc *stream;
@@ -31,6 +31,7 @@
stream->by_id.key = id;
eb64_insert(&qc->streams_by_id, &stream->by_id);
+ qc->rx.strms[type].nb_streams++;
stream->qc = qc;
stream->buf = NULL;
diff --git a/src/xprt_quic.c b/src/xprt_quic.c
index 778f197..a83fb0c 100644
--- a/src/xprt_quic.c
+++ b/src/xprt_quic.c
@@ -4365,6 +4365,8 @@
/* RX part. */
qc->rx.bytes = 0;
qc->rx.buf = b_make(buf_area, QUIC_CONN_RX_BUFSZ, 0, 0);
+ for (i = 0; i < QCS_MAX_TYPES; i++)
+ qc->rx.strms[i].nb_streams = 0;
qc->nb_pkt_for_cc = 1;
qc->nb_pkt_since_cc = 0;