summaryrefslogtreecommitdiffhomepage
path: root/src/http/v3/ngx_http_v3_uni.c
diff options
context:
space:
mode:
authorRoman Arutyunyan <arut@nginx.com>2022-11-29 17:46:46 +0400
committerRoman Arutyunyan <arut@nginx.com>2022-11-29 17:46:46 +0400
commitdc82bed893cc4292c459d41269882b621b98f5b3 (patch)
tree8c7a7740c0c72dc3bed50bf5f296f7e6a560931c /src/http/v3/ngx_http_v3_uni.c
parenta89167c247afd67e43017583033463f551737262 (diff)
downloadnginx-dc82bed893cc4292c459d41269882b621b98f5b3.tar.gz
nginx-dc82bed893cc4292c459d41269882b621b98f5b3.tar.bz2
QUIC: reusable mode for main connection.
The connection is automatically switched to this mode by transport layer when there are no non-cancelable streams. Currently, cancelable streams are HTTP/3 encoder/decoder/control streams.
Diffstat (limited to 'src/http/v3/ngx_http_v3_uni.c')
-rw-r--r--src/http/v3/ngx_http_v3_uni.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/http/v3/ngx_http_v3_uni.c b/src/http/v3/ngx_http_v3_uni.c
index 96b7d7ebf..d6a6e97e6 100644
--- a/src/http/v3/ngx_http_v3_uni.c
+++ b/src/http/v3/ngx_http_v3_uni.c
@@ -52,7 +52,7 @@ ngx_http_v3_init_uni_stream(ngx_connection_t *c)
return;
}
- c->quic->cancelable = 1;
+ ngx_quic_cancelable_stream(c);
us = ngx_pcalloc(c->pool, sizeof(ngx_http_v3_uni_stream_t));
if (us == NULL) {
@@ -182,6 +182,11 @@ ngx_http_v3_uni_read_handler(ngx_event_t *rev)
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "http3 read handler");
+ if (c->close) {
+ ngx_http_v3_close_uni_stream(c);
+ return;
+ }
+
ngx_memzero(&b, sizeof(ngx_buf_t));
while (rev->ready) {
@@ -262,6 +267,11 @@ ngx_http_v3_uni_dummy_read_handler(ngx_event_t *rev)
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "http3 dummy read handler");
+ if (c->close) {
+ ngx_http_v3_close_uni_stream(c);
+ return;
+ }
+
if (rev->ready) {
if (c->recv(c, &ch, 1) != 0) {
ngx_http_v3_finalize_connection(c, NGX_HTTP_V3_ERR_NO_ERROR, NULL);
@@ -404,7 +414,7 @@ ngx_http_v3_get_uni_stream(ngx_connection_t *c, ngx_uint_t type)
goto failed;
}
- sc->quic->cancelable = 1;
+ ngx_quic_cancelable_stream(sc);
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
"http3 create uni stream, type:%ui", type);