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.
This commit is contained in:
Frédéric Lécaille 2022-05-02 18:46:58 +02:00 committed by Amaury Denoyelle
parent b074966634
commit 664741e1c5
5 changed files with 11 additions and 3 deletions

View File

@ -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);

View File

@ -743,6 +743,10 @@ struct quic_conn {
/* 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;

View File

@ -123,7 +123,7 @@ struct qcs *qcs_new(struct qcc *qcc, uint64_t id, enum qcs_type type)
* 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;

View File

@ -20,7 +20,7 @@ DECLARE_STATIC_POOL(pool_head_quic_conn_stream_buf, "qc_stream_buf",
*
* 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 @@ struct qc_stream_desc *qc_stream_desc_new(uint64_t id, void *ctx,
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;

View File

@ -4365,6 +4365,8 @@ static struct quic_conn *qc_new_conn(unsigned int version, int ipv4,
/* 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;