summaryrefslogtreecommitdiffhomepage
path: root/src/event/quic/ngx_event_quic.c
diff options
context:
space:
mode:
authorRoman Arutyunyan <arut@nginx.com>2022-10-19 17:45:18 +0400
committerRoman Arutyunyan <arut@nginx.com>2022-10-19 17:45:18 +0400
commitfed44881d3bf5126b49144dba58f2830e0fe9866 (patch)
tree6137fc2bdbb276dfceb695f1f10bc674e44fa139 /src/event/quic/ngx_event_quic.c
parentdd4c31fc34bd8390dd3fa9e804afc15b57b69135 (diff)
downloadnginx-fed44881d3bf5126b49144dba58f2830e0fe9866.tar.gz
nginx-fed44881d3bf5126b49144dba58f2830e0fe9866.tar.bz2
QUIC: idle mode for main connection.
Now main QUIC connection for HTTP/3 always has c->idle flag set. This allows the connection to receive worker shutdown notification. It is passed to application level via a new conf->shutdown() callback. The HTTP/3 shutdown callback sends GOAWAY to client and gracefully shuts down the QUIC connection.
Diffstat (limited to '')
-rw-r--r--src/event/quic/ngx_event_quic.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/event/quic/ngx_event_quic.c b/src/event/quic/ngx_event_quic.c
index 7245ee7d0..a28f5a7ac 100644
--- a/src/event/quic/ngx_event_quic.c
+++ b/src/event/quic/ngx_event_quic.c
@@ -341,6 +341,7 @@ ngx_quic_new_connection(ngx_connection_t *c, ngx_quic_conf_t *conf,
return NULL;
}
+ c->idle = 1;
ngx_reusable_connection(c, 1);
ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, 0,
@@ -420,9 +421,19 @@ ngx_quic_input_handler(ngx_event_t *rev)
}
if (c->close) {
- qc->error = NGX_QUIC_ERR_NO_ERROR;
- qc->error_reason = "graceful shutdown";
- ngx_quic_close_connection(c, NGX_ERROR);
+ c->close = 0;
+
+ if (!ngx_exiting) {
+ qc->error = NGX_QUIC_ERR_NO_ERROR;
+ qc->error_reason = "graceful shutdown";
+ ngx_quic_close_connection(c, NGX_ERROR);
+ return;
+ }
+
+ if (!qc->closing && qc->conf->shutdown) {
+ qc->conf->shutdown(c);
+ }
+
return;
}