BUG/MINOR: mux-quic: properly initialize flow control

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.
This commit is contained in:
Amaury Denoyelle 2021-12-08 15:12:01 +01:00
parent 5154e7a252
commit f3b0ba7dc9
2 changed files with 27 additions and 0 deletions

View File

@ -42,6 +42,9 @@ struct qcc {
} tx; } tx;
} strms[QCS_MAX_TYPES]; } strms[QCS_MAX_TYPES];
struct {
uint64_t max_data; /* Maximum number of bytes which may be received */
} rx;
struct { struct {
uint64_t max_data; /* Maximum number of bytes which may be sent */ uint64_t max_data; /* Maximum number of bytes which may be sent */
} tx; } tx;

View File

@ -312,6 +312,7 @@ static int qc_init(struct connection *conn, struct proxy *prx,
struct session *sess, struct buffer *input) struct session *sess, struct buffer *input)
{ {
struct qcc *qcc; struct qcc *qcc;
struct quic_transport_params *srv_params;
qcc = pool_alloc(pool_head_qcc); qcc = pool_alloc(pool_head_qcc);
if (!qcc) if (!qcc)
@ -325,14 +326,37 @@ static int qc_init(struct connection *conn, struct proxy *prx,
qcc->streams_by_id = EB_ROOT_UNIQUE; 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].nb_streams = 0;
qcc->strms[QCS_CLT_BIDI].largest_id = -1; 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].nb_streams = 0;
qcc->strms[QCS_CLT_UNI].largest_id = -1; 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].nb_streams = 0;
qcc->strms[QCS_SRV_BIDI].largest_id = -1; 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].nb_streams = 0;
qcc->strms[QCS_SRV_UNI].largest_id = -1; 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(); qcc->wait_event.tasklet = tasklet_new();
if (!qcc->wait_event.tasklet) if (!qcc->wait_event.tasklet)