diff src/http/v3/ngx_http_v3.h @ 8988:6434160b4b78 quic

QUIC: allowed main QUIC connection for some operations. Operations like ngx_quic_open_stream(), ngx_http_quic_get_connection(), ngx_http_v3_finalize_connection(), ngx_http_v3_shutdown_connection() used to receive a QUIC stream connection. Now they can receive the main QUIC connection as well. This is useful when calling them from a stream context.
author Roman Arutyunyan <arut@nginx.com>
date Mon, 31 Jan 2022 09:16:47 +0300
parents 3d0fc72d409e
children efbcdb9b37dc
line wrap: on
line diff
--- a/src/http/v3/ngx_http_v3.h
+++ b/src/http/v3/ngx_http_v3.h
@@ -78,7 +78,8 @@
 
 
 #define ngx_http_quic_get_connection(c)                                       \
-    ((ngx_http_connection_t *) (c)->quic->parent->data)
+    ((ngx_http_connection_t *) ((c)->quic ? (c)->quic->parent->data           \
+                                          : (c)->data))
 
 #define ngx_http_v3_get_session(c)  ngx_http_quic_get_connection(c)->v3_session
 
@@ -91,10 +92,12 @@
                                  module)
 
 #define ngx_http_v3_finalize_connection(c, code, reason)                      \
-    ngx_quic_finalize_connection(c->quic->parent, code, reason)
+    ngx_quic_finalize_connection((c)->quic ? (c)->quic->parent : (c),         \
+                                 code, reason)
 
 #define ngx_http_v3_shutdown_connection(c, code, reason)                      \
-    ngx_quic_shutdown_connection(c->quic->parent, code, reason)
+    ngx_quic_shutdown_connection((c)->quic ? (c)->quic->parent : (c),         \
+                                 code, reason)
 
 
 typedef struct {