Mercurial > hg > nginx
diff src/event/quic/ngx_event_quic.c @ 9055:1192923be0aa quic
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.
author | Roman Arutyunyan <arut@nginx.com> |
---|---|
date | Wed, 19 Oct 2022 17:45:18 +0400 |
parents | 37d5dddabaea |
children | be39ffdf9208 |
line wrap: on
line diff
--- 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 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; }