summaryrefslogtreecommitdiffhomepage
path: root/src/event/quic/ngx_event_quic.c
diff options
context:
space:
mode:
authorRoman Arutyunyan <arut@nginx.com>2021-05-25 13:55:12 +0300
committerRoman Arutyunyan <arut@nginx.com>2021-05-25 13:55:12 +0300
commitcd86cf34db80c517c8e26bb81bc393065eb96eda (patch)
tree3848c44838684577a48921c6611241ea3334d562 /src/event/quic/ngx_event_quic.c
parentf1378601010b8f2857ac7c043ec4ac6d534543bb (diff)
downloadnginx-cd86cf34db80c517c8e26bb81bc393065eb96eda.tar.gz
nginx-cd86cf34db80c517c8e26bb81bc393065eb96eda.tar.bz2
QUIC: refactored CRYPTO and STREAM buffer ordering.
Generic function ngx_quic_order_bufs() is introduced. This function creates and maintains a chain of buffers with holes. Holes are marked with b->sync flag. Several buffers and holes in this chain may share the same underlying memory buffer. When processing STREAM frames with this function, frame data is copied only once to the right place in the stream input chain. Previously data could be copied twice. First when buffering an out-of-order frame data, and then when filling stream buffer from ordered frame queue. Now there's only one data chain for both tasks.
Diffstat (limited to 'src/event/quic/ngx_event_quic.c')
-rw-r--r--src/event/quic/ngx_event_quic.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/event/quic/ngx_event_quic.c b/src/event/quic/ngx_event_quic.c
index b1aa758ee..cc83df0ce 100644
--- a/src/event/quic/ngx_event_quic.c
+++ b/src/event/quic/ngx_event_quic.c
@@ -266,10 +266,6 @@ ngx_quic_new_connection(ngx_connection_t *c, ngx_quic_conf_t *conf,
qc->send_ctx[1].level = ssl_encryption_handshake;
qc->send_ctx[2].level = ssl_encryption_application;
- for (i = 0; i < NGX_QUIC_ENCRYPTION_LAST; i++) {
- ngx_queue_init(&qc->crypto[i].frames);
- }
-
ngx_queue_init(&qc->free_frames);
qc->avg_rtt = NGX_QUIC_INITIAL_RTT;
@@ -1022,6 +1018,8 @@ ngx_quic_discard_ctx(ngx_connection_t *c, enum ssl_encryption_level_t level)
ctx = ngx_quic_get_send_ctx(qc, level);
+ ngx_quic_free_bufs(c, ctx->crypto);
+
while (!ngx_queue_empty(&ctx->sent)) {
q = ngx_queue_head(&ctx->sent);
ngx_queue_remove(q);