Mercurial > hg > nginx
comparison src/http/v3/ngx_http_v3_uni.c @ 9051:37d5dddabaea quic
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.
author | Roman Arutyunyan <arut@nginx.com> |
---|---|
date | Tue, 29 Nov 2022 17:46:46 +0400 |
parents | a5aebd51e4c7 |
children | 6546c2ae1c7b |
comparison
equal
deleted
inserted
replaced
9050:aaca8e111959 | 9051:37d5dddabaea |
---|---|
50 c->data = NULL; | 50 c->data = NULL; |
51 ngx_http_v3_close_uni_stream(c); | 51 ngx_http_v3_close_uni_stream(c); |
52 return; | 52 return; |
53 } | 53 } |
54 | 54 |
55 c->quic->cancelable = 1; | 55 ngx_quic_cancelable_stream(c); |
56 | 56 |
57 us = ngx_pcalloc(c->pool, sizeof(ngx_http_v3_uni_stream_t)); | 57 us = ngx_pcalloc(c->pool, sizeof(ngx_http_v3_uni_stream_t)); |
58 if (us == NULL) { | 58 if (us == NULL) { |
59 ngx_http_v3_finalize_connection(c, | 59 ngx_http_v3_finalize_connection(c, |
60 NGX_HTTP_V3_ERR_INTERNAL_ERROR, | 60 NGX_HTTP_V3_ERR_INTERNAL_ERROR, |
180 c = rev->data; | 180 c = rev->data; |
181 us = c->data; | 181 us = c->data; |
182 | 182 |
183 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "http3 read handler"); | 183 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "http3 read handler"); |
184 | 184 |
185 if (c->close) { | |
186 ngx_http_v3_close_uni_stream(c); | |
187 return; | |
188 } | |
189 | |
185 ngx_memzero(&b, sizeof(ngx_buf_t)); | 190 ngx_memzero(&b, sizeof(ngx_buf_t)); |
186 | 191 |
187 while (rev->ready) { | 192 while (rev->ready) { |
188 | 193 |
189 n = c->recv(c, buf, sizeof(buf)); | 194 n = c->recv(c, buf, sizeof(buf)); |
259 ngx_connection_t *c; | 264 ngx_connection_t *c; |
260 | 265 |
261 c = rev->data; | 266 c = rev->data; |
262 | 267 |
263 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "http3 dummy read handler"); | 268 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "http3 dummy read handler"); |
269 | |
270 if (c->close) { | |
271 ngx_http_v3_close_uni_stream(c); | |
272 return; | |
273 } | |
264 | 274 |
265 if (rev->ready) { | 275 if (rev->ready) { |
266 if (c->recv(c, &ch, 1) != 0) { | 276 if (c->recv(c, &ch, 1) != 0) { |
267 ngx_http_v3_finalize_connection(c, NGX_HTTP_V3_ERR_NO_ERROR, NULL); | 277 ngx_http_v3_finalize_connection(c, NGX_HTTP_V3_ERR_NO_ERROR, NULL); |
268 ngx_http_v3_close_uni_stream(c); | 278 ngx_http_v3_close_uni_stream(c); |
402 sc = ngx_quic_open_stream(c, 0); | 412 sc = ngx_quic_open_stream(c, 0); |
403 if (sc == NULL) { | 413 if (sc == NULL) { |
404 goto failed; | 414 goto failed; |
405 } | 415 } |
406 | 416 |
407 sc->quic->cancelable = 1; | 417 ngx_quic_cancelable_stream(sc); |
408 | 418 |
409 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, | 419 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, |
410 "http3 create uni stream, type:%ui", type); | 420 "http3 create uni stream, type:%ui", type); |
411 | 421 |
412 us = ngx_pcalloc(sc->pool, sizeof(ngx_http_v3_uni_stream_t)); | 422 us = ngx_pcalloc(sc->pool, sizeof(ngx_http_v3_uni_stream_t)); |