Mercurial > hg > nginx
changeset 8828:a9f6540e61da quic
QUIC: asynchronous shutdown.
Previously, when cleaning up a QUIC stream in shutdown mode,
ngx_quic_shutdown_quic() was called, which could close the QUIC connection
right away. This could be a problem if the connection was referenced up the
stack. For example, this could happen in ngx_quic_init_streams(),
ngx_quic_close_streams(), ngx_quic_create_client_stream() etc.
With a typical HTTP/3 client the issue is unlikely because of HTTP/3 uni
streams which need a posted event to close. In this case QUIC connection
cannot be closed right away.
Now QUIC connection read event is posted and it will shut down the connection
asynchronously.
author | Roman Arutyunyan <arut@nginx.com> |
---|---|
date | Thu, 05 Aug 2021 09:20:32 +0300 |
parents | fe919fd63b0b |
children | 4f922f611135 |
files | src/event/quic/ngx_event_quic.c src/event/quic/ngx_event_quic_streams.c |
diffstat | 2 files changed, 5 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/event/quic/ngx_event_quic.c Wed Aug 04 15:49:18 2021 +0300 +++ b/src/event/quic/ngx_event_quic.c Thu Aug 05 09:20:32 2021 +0300 @@ -421,7 +421,11 @@ if (!rev->ready) { if (qc->closing) { ngx_quic_close_connection(c, NGX_OK); + + } else if (qc->shutdown) { + ngx_quic_shutdown_quic(c); } + return; }
--- a/src/event/quic/ngx_event_quic_streams.c Wed Aug 04 15:49:18 2021 +0300 +++ b/src/event/quic/ngx_event_quic_streams.c Thu Aug 05 09:20:32 2021 +0300 @@ -849,7 +849,7 @@ (void) ngx_quic_output(pc); if (qc->shutdown) { - ngx_quic_shutdown_quic(pc); + ngx_post_event(pc->read, &ngx_posted_events); } }