aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKasei Wang <kasei@kasei.im>2024-07-18 17:43:25 +0400
committerKasei Wang <kasei@kasei.im>2024-07-18 17:43:25 +0400
commit145b228530c364452c14d3184f1eee5e09b324aa (patch)
tree0c57996cf5ca94f057bbc3daee85889dcb7cd93d /src
parent788e462c5b81f5f1aee475488e10f01680c530e9 (diff)
downloadnginx-145b228530c364452c14d3184f1eee5e09b324aa.tar.gz
nginx-145b228530c364452c14d3184f1eee5e09b324aa.zip
HTTP/2: close connections initialized during graceful shutdown.
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.
Diffstat (limited to 'src')
-rw-r--r--src/http/v2/ngx_http_v2.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/http/v2/ngx_http_v2.c b/src/http/v2/ngx_http_v2.c
index 0f5bd3de8..91a28b228 100644
--- a/src/http/v2/ngx_http_v2.c
+++ b/src/http/v2/ngx_http_v2.c
@@ -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;