diff options
Diffstat (limited to 'src/http/v3/ngx_http_v3_streams.c')
-rw-r--r-- | src/http/v3/ngx_http_v3_streams.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/http/v3/ngx_http_v3_streams.c b/src/http/v3/ngx_http_v3_streams.c index 693225b89..1b0f91454 100644 --- a/src/http/v3/ngx_http_v3_streams.c +++ b/src/http/v3/ngx_http_v3_streams.c @@ -35,10 +35,24 @@ static ngx_connection_t *ngx_http_v3_get_uni_stream(ngx_connection_t *c, void ngx_http_v3_init_uni_stream(ngx_connection_t *c) { + uint64_t n; + ngx_http_v3_srv_conf_t *h3scf; ngx_http_v3_uni_stream_t *us; ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "http3 init uni stream"); + h3scf = ngx_http_v3_get_module_srv_conf(c, ngx_http_v3_module); + + n = c->quic->id >> 2; + + if (n >= h3scf->max_uni_streams) { + ngx_http_v3_finalize_connection(c, + NGX_HTTP_V3_ERR_STREAM_CREATION_ERROR, + "reached maximum number of uni streams"); + ngx_http_close_connection(c); + return; + } + c->quic->cancelable = 1; us = ngx_pcalloc(c->pool, sizeof(ngx_http_v3_uni_stream_t)); |