Mercurial > hg > nginx
comparison 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 |
comparison
equal
deleted
inserted
replaced
9054:6546c2ae1c7b | 9055:1192923be0aa |
---|---|
339 | 339 |
340 if (ngx_quic_open_sockets(c, qc, pkt) != NGX_OK) { | 340 if (ngx_quic_open_sockets(c, qc, pkt) != NGX_OK) { |
341 return NULL; | 341 return NULL; |
342 } | 342 } |
343 | 343 |
344 c->idle = 1; | |
344 ngx_reusable_connection(c, 1); | 345 ngx_reusable_connection(c, 1); |
345 | 346 |
346 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, 0, | 347 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, 0, |
347 "quic connection created"); | 348 "quic connection created"); |
348 | 349 |
418 ngx_quic_close_connection(c, NGX_DONE); | 419 ngx_quic_close_connection(c, NGX_DONE); |
419 return; | 420 return; |
420 } | 421 } |
421 | 422 |
422 if (c->close) { | 423 if (c->close) { |
423 qc->error = NGX_QUIC_ERR_NO_ERROR; | 424 c->close = 0; |
424 qc->error_reason = "graceful shutdown"; | 425 |
425 ngx_quic_close_connection(c, NGX_ERROR); | 426 if (!ngx_exiting) { |
427 qc->error = NGX_QUIC_ERR_NO_ERROR; | |
428 qc->error_reason = "graceful shutdown"; | |
429 ngx_quic_close_connection(c, NGX_ERROR); | |
430 return; | |
431 } | |
432 | |
433 if (!qc->closing && qc->conf->shutdown) { | |
434 qc->conf->shutdown(c); | |
435 } | |
436 | |
426 return; | 437 return; |
427 } | 438 } |
428 | 439 |
429 b = c->udp->buffer; | 440 b = c->udp->buffer; |
430 if (b == NULL) { | 441 if (b == NULL) { |