diff src/http/v3/ngx_http_v3.c @ 8990:b0c2234aaa9f quic

QUIC: application init() callback. It's called after handshake completion or prior to the first early data stream creation. The callback should initialize application-level data before creating streams. HTTP/3 callback implementation sets keepalive timer and sends SETTINGS. Also, this allows to limit max handshake time in ngx_http_v3_init_stream().
author Roman Arutyunyan <arut@nginx.com>
date Wed, 30 Nov 2022 12:51:15 +0400
parents be39ffdf9208
children c851a2ed5ce8
line wrap: on
line diff
--- a/src/http/v3/ngx_http_v3.c
+++ b/src/http/v3/ngx_http_v3.c
@@ -17,7 +17,6 @@ static void ngx_http_v3_cleanup_session(
 ngx_int_t
 ngx_http_v3_init_session(ngx_connection_t *c)
 {
-    ngx_connection_t        *pc;
     ngx_pool_cleanup_t      *cln;
     ngx_http_connection_t   *hc;
     ngx_http_v3_session_t   *h3c;
@@ -25,16 +24,11 @@ ngx_http_v3_init_session(ngx_connection_
     ngx_http_v3_srv_conf_t  *h3scf;
 #endif
 
-    pc = c->quic->parent;
-    hc = pc->data;
-
-    if (hc->v3_session) {
-        return NGX_OK;
-    }
+    hc = c->data;
 
     ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "http3 init session");
 
-    h3c = ngx_pcalloc(pc->pool, sizeof(ngx_http_v3_session_t));
+    h3c = ngx_pcalloc(c->pool, sizeof(ngx_http_v3_session_t));
     if (h3c == NULL) {
         goto failed;
     }
@@ -52,15 +46,15 @@ ngx_http_v3_init_session(ngx_connection_
     ngx_queue_init(&h3c->blocked);
     ngx_queue_init(&h3c->pushing);
 
-    h3c->keepalive.log = pc->log;
-    h3c->keepalive.data = pc;
+    h3c->keepalive.log = c->log;
+    h3c->keepalive.data = c;
     h3c->keepalive.handler = ngx_http_v3_keepalive_handler;
 
-    h3c->table.send_insert_count.log = pc->log;
-    h3c->table.send_insert_count.data = pc;
+    h3c->table.send_insert_count.log = c->log;
+    h3c->table.send_insert_count.data = c;
     h3c->table.send_insert_count.handler = ngx_http_v3_inc_insert_count_handler;
 
-    cln = ngx_pool_cleanup_add(pc->pool, 0);
+    cln = ngx_pool_cleanup_add(c->pool, 0);
     if (cln == NULL) {
         goto failed;
     }
@@ -70,13 +64,7 @@ ngx_http_v3_init_session(ngx_connection_
 
     hc->v3_session = h3c;
 
-#if (NGX_HTTP_V3_HQ)
-    if (h3c->hq) {
-        return NGX_OK;
-    }
-#endif
-
-    return ngx_http_v3_send_settings(c);
+    return NGX_OK;
 
 failed: