comparison src/http/v3/ngx_http_v3_tables.c @ 8769:9ec3e71f8a61 quic

HTTP/3: reference h3c directly from ngx_http_connection_t. Previously, an ngx_http_v3_connection_t object was created for HTTP/3 and then assinged to c->data instead of the generic ngx_http_connection_t object. Now a direct reference is added to ngx_http_connection_t, which is less confusing and does not require a flag for http3.
author Roman Arutyunyan <arut@nginx.com>
date Wed, 05 May 2021 14:53:36 +0300
parents 40d710a66aef
children 67f0eb150047
comparison
equal deleted inserted replaced
8768:40d710a66aef 8769:9ec3e71f8a61
249 249
250 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, 250 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
251 "http3 set capacity %ui", capacity); 251 "http3 set capacity %ui", capacity);
252 252
253 h3c = ngx_http_v3_get_session(c); 253 h3c = ngx_http_v3_get_session(c);
254 h3scf = ngx_http_get_module_srv_conf(h3c->hc.conf_ctx, ngx_http_v3_module); 254 h3scf = ngx_http_v3_get_module_srv_conf(c, ngx_http_v3_module);
255 255
256 if (capacity > h3scf->max_table_capacity) { 256 if (capacity > h3scf->max_table_capacity) {
257 ngx_log_error(NGX_LOG_INFO, c->log, 0, 257 ngx_log_error(NGX_LOG_INFO, c->log, 0,
258 "client exceeded http3_max_table_capacity limit"); 258 "client exceeded http3_max_table_capacity limit");
259 return NGX_HTTP_V3_ERR_ENCODER_STREAM_ERROR; 259 return NGX_HTTP_V3_ERR_ENCODER_STREAM_ERROR;
496 } 496 }
497 497
498 h3c = ngx_http_v3_get_session(c); 498 h3c = ngx_http_v3_get_session(c);
499 dt = &h3c->table; 499 dt = &h3c->table;
500 500
501 h3scf = ngx_http_get_module_srv_conf(h3c->hc.conf_ctx, ngx_http_v3_module); 501 h3scf = ngx_http_v3_get_module_srv_conf(c, ngx_http_v3_module);
502 502
503 max_entries = h3scf->max_table_capacity / 32; 503 max_entries = h3scf->max_table_capacity / 32;
504 full_range = 2 * max_entries; 504 full_range = 2 * max_entries;
505 505
506 if (*insert_count > full_range) { 506 if (*insert_count > full_range) {
580 block->connection = c; 580 block->connection = c;
581 block->nblocked = &h3c->nblocked; 581 block->nblocked = &h3c->nblocked;
582 } 582 }
583 583
584 if (block->queue.prev == NULL) { 584 if (block->queue.prev == NULL) {
585 h3scf = ngx_http_get_module_srv_conf(h3c->hc.conf_ctx, 585 h3scf = ngx_http_v3_get_module_srv_conf(c, ngx_http_v3_module);
586 ngx_http_v3_module);
587 586
588 if (h3c->nblocked == h3scf->max_blocked_streams) { 587 if (h3c->nblocked == h3scf->max_blocked_streams) {
589 ngx_log_error(NGX_LOG_INFO, c->log, 0, 588 ngx_log_error(NGX_LOG_INFO, c->log, 0,
590 "client exceeded http3_max_blocked_streams limit"); 589 "client exceeded http3_max_blocked_streams limit");
591 return NGX_HTTP_V3_ERR_DECOMPRESSION_FAILED; 590 return NGX_HTTP_V3_ERR_DECOMPRESSION_FAILED;