diff src/http/v3/ngx_http_v3_streams.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 33ec97749b5f
children 9ec3e71f8a61
line wrap: on
line diff
--- a/src/http/v3/ngx_http_v3_streams.c
+++ b/src/http/v3/ngx_http_v3_streams.c
@@ -148,7 +148,7 @@ ngx_http_v3_close_uni_stream(ngx_connect
     ngx_http_v3_uni_stream_t  *us;
 
     us = c->data;
-    h3c = c->quic->parent->data;
+    h3c = ngx_http_v3_get_session(c);
 
     ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "http3 close stream");
 
@@ -178,7 +178,7 @@ ngx_http_v3_read_uni_stream_type(ngx_eve
 
     c = rev->data;
     us = c->data;
-    h3c = c->quic->parent->data;
+    h3c = ngx_http_v3_get_session(c);
 
     ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "http3 read stream type");
 
@@ -410,7 +410,7 @@ ngx_http_v3_create_push_stream(ngx_conne
         goto failed;
     }
 
-    h3c = c->quic->parent->data;
+    h3c = ngx_http_v3_get_session(c);
     h3c->npushing++;
 
     cln->handler = ngx_http_v3_push_cleanup;
@@ -466,7 +466,7 @@ ngx_http_v3_get_uni_stream(ngx_connectio
         index = -1;
     }
 
-    h3c = c->quic->parent->data;
+    h3c = ngx_http_v3_get_session(c);
 
     if (index >= 0) {
         if (h3c->known_streams[index]) {
@@ -525,7 +525,7 @@ ngx_http_v3_send_settings(ngx_connection
     ngx_http_v3_srv_conf_t    *h3scf;
     ngx_http_v3_connection_t  *h3c;
 
-    h3c = c->quic->parent->data;
+    h3c = ngx_http_v3_get_session(c);
 
     ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "http3 send settings");
 
@@ -837,7 +837,7 @@ ngx_http_v3_set_max_push_id(ngx_connecti
 {
     ngx_http_v3_connection_t  *h3c;
 
-    h3c = c->quic->parent->data;
+    h3c = ngx_http_v3_get_session(c);
 
     ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
                    "http3 MAX_PUSH_ID:%uL", max_push_id);
@@ -860,7 +860,7 @@ ngx_http_v3_cancel_push(ngx_connection_t
     ngx_http_v3_push_t        *push;
     ngx_http_v3_connection_t  *h3c;
 
-    h3c = c->quic->parent->data;
+    h3c = ngx_http_v3_get_session(c);
 
     ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
                    "http3 CANCEL_PUSH:%uL", push_id);