]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: mux-quic: properly initialize flow control
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 8 Dec 2021 14:12:01 +0000 (15:12 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 8 Dec 2021 14:26:16 +0000 (15:26 +0100)
Initialize all flow control members on the qcc instance. Without this,
the value are undefined and it may be possible to have errors about
reached streams limit.

include/haproxy/mux_quic-t.h
src/mux_quic.c

index eb3d6e902a92918a510c2f78bf6ebf43f3ec8a07..0a60868a06652d72832e113032fff1c930237001 100644 (file)
@@ -42,6 +42,9 @@ struct qcc {
                } tx;
        } strms[QCS_MAX_TYPES];
 
+       struct {
+               uint64_t max_data; /* Maximum number of bytes which may be received */
+       } rx;
        struct {
                uint64_t max_data; /* Maximum number of bytes which may be sent */
        } tx;
index 89d7875e86acd98ee389966554551165444fd197..c4bd1bfd5e1456085d5ce40dfa68adb50eec67d9 100644 (file)
@@ -312,6 +312,7 @@ static int qc_init(struct connection *conn, struct proxy *prx,
                    struct session *sess, struct buffer *input)
 {
        struct qcc *qcc;
+       struct quic_transport_params *srv_params;
 
        qcc = pool_alloc(pool_head_qcc);
        if (!qcc)
@@ -325,14 +326,37 @@ static int qc_init(struct connection *conn, struct proxy *prx,
 
        qcc->streams_by_id = EB_ROOT_UNIQUE;
 
+       /* Server parameters, params used for RX flow control. */
+       srv_params = &conn->qc->rx.params;
+
+       qcc->rx.max_data = srv_params->initial_max_data;
+       qcc->tx.max_data = 0;
+
+       /* Client initiated streams must respect the server flow control. */
+       qcc->strms[QCS_CLT_BIDI].max_streams = srv_params->initial_max_streams_bidi;
        qcc->strms[QCS_CLT_BIDI].nb_streams = 0;
        qcc->strms[QCS_CLT_BIDI].largest_id = -1;
+       qcc->strms[QCS_CLT_BIDI].rx.max_data = 0;
+       qcc->strms[QCS_CLT_BIDI].tx.max_data = srv_params->initial_max_stream_data_bidi_remote;
+
+       qcc->strms[QCS_CLT_UNI].max_streams = srv_params->initial_max_streams_uni;
        qcc->strms[QCS_CLT_UNI].nb_streams = 0;
        qcc->strms[QCS_CLT_UNI].largest_id = -1;
+       qcc->strms[QCS_CLT_UNI].rx.max_data = 0;
+       qcc->strms[QCS_CLT_UNI].tx.max_data = srv_params->initial_max_stream_data_uni;
+
+       /* Server initiated streams must respect the server flow control. */
+       qcc->strms[QCS_SRV_BIDI].max_streams = 0;
        qcc->strms[QCS_SRV_BIDI].nb_streams = 0;
        qcc->strms[QCS_SRV_BIDI].largest_id = -1;
+       qcc->strms[QCS_SRV_BIDI].rx.max_data = srv_params->initial_max_stream_data_bidi_local;
+       qcc->strms[QCS_SRV_BIDI].tx.max_data = 0;
+
+       qcc->strms[QCS_SRV_UNI].max_streams = 0;
        qcc->strms[QCS_SRV_UNI].nb_streams = 0;
        qcc->strms[QCS_SRV_UNI].largest_id = -1;
+       qcc->strms[QCS_SRV_UNI].rx.max_data = srv_params->initial_max_stream_data_uni;
+       qcc->strms[QCS_SRV_UNI].tx.max_data = 0;
 
        qcc->wait_event.tasklet = tasklet_new();
        if (!qcc->wait_event.tasklet)