]> git.feebdaed.xyz Git - 0xmirror/nginx.git/commitdiff
HTTP/2: close connections initialized during graceful shutdown.
authorKasei Wang <kasei@kasei.im>
Thu, 18 Jul 2024 13:43:25 +0000 (17:43 +0400)
committerKasei Wang <kasei@kasei.im>
Thu, 18 Jul 2024 13:43:25 +0000 (17:43 +0400)
In some rare cases, graceful shutdown may happen while initializing an HTTP/2
connection.  Previously, such a connection ignored the shutdown and remained
active.  Now it is gracefully closed prior to processing any streams to
eliminate the shutdown delay.

src/http/v2/ngx_http_v2.c

index 0f5bd3de8d08690b79da708899a27bf9565fff6c..91a28b2281b8252f08aac633aa973e2a039a3e05 100644 (file)
@@ -292,6 +292,11 @@ ngx_http_v2_init(ngx_event_t *rev)
 
     c->data = h2c;
 
+    if (ngx_exiting) {
+        ngx_http_v2_finalize_connection(h2c, NGX_HTTP_V2_NO_ERROR);
+        return;
+    }
+
     rev->handler = ngx_http_v2_read_handler;
     c->write->handler = ngx_http_v2_write_handler;