comparison src/http/v3/ngx_http_v3_filter_module.c @ 8768:40d710a66aef quic

HTTP/3: ngx_http_v3_get_session() macro. It's used instead of accessing c->quic->parent->data directly. Apart from being simpler, it allows to change the way session is stored in the future by changing the macro.
author Roman Arutyunyan <arut@nginx.com>
date Fri, 30 Apr 2021 19:10:11 +0300
parents 5cb5b568282b
children 67f0eb150047
comparison
equal deleted inserted replaced
8767:33ec97749b5f 8768:40d710a66aef
781 ngx_connection_t *c; 781 ngx_connection_t *c;
782 ngx_http_v3_srv_conf_t *h3scf; 782 ngx_http_v3_srv_conf_t *h3scf;
783 ngx_http_v3_connection_t *h3c; 783 ngx_http_v3_connection_t *h3c;
784 784
785 c = r->connection; 785 c = r->connection;
786 h3c = c->quic->parent->data; 786 h3c = ngx_http_v3_get_session(c);
787 h3scf = ngx_http_get_module_srv_conf(r, ngx_http_v3_module); 787 h3scf = ngx_http_get_module_srv_conf(r, ngx_http_v3_module);
788 788
789 ngx_log_debug5(NGX_LOG_DEBUG_HTTP, c->log, 0, 789 ngx_log_debug5(NGX_LOG_DEBUG_HTTP, c->log, 0,
790 "http3 push \"%V\" pushing:%ui/%ui id:%uL/%L", 790 "http3 push \"%V\" pushing:%ui/%ui id:%uL/%L",
791 path, h3c->npushing, h3scf->max_concurrent_pushes, 791 path, h3c->npushing, h3scf->max_concurrent_pushes,
856 hc = ngx_palloc(c->pool, sizeof(ngx_http_connection_t)); 856 hc = ngx_palloc(c->pool, sizeof(ngx_http_connection_t));
857 if (hc == NULL) { 857 if (hc == NULL) {
858 goto failed; 858 goto failed;
859 } 859 }
860 860
861 h3c = c->quic->parent->data; 861 h3c = ngx_http_v3_get_session(c);
862 ngx_memcpy(hc, h3c, sizeof(ngx_http_connection_t)); 862 ngx_memcpy(hc, h3c, sizeof(ngx_http_connection_t));
863 c->data = hc; 863 c->data = hc;
864 864
865 ctx = ngx_palloc(c->pool, sizeof(ngx_http_log_ctx_t)); 865 ctx = ngx_palloc(c->pool, sizeof(ngx_http_log_ctx_t));
866 if (ctx == NULL) { 866 if (ctx == NULL) {