From 1381932d27a2ccba206633bb5febea72de9c56c2 Mon Sep 17 00:00:00 2001 From: Sergey Kandaurov Date: Tue, 15 Feb 2022 14:12:34 +0300 Subject: [PATCH] QUIC: optimized datagram expansion with half-RTT tickets. As shown in RFC 8446, section 2.2, Figure 3, and further specified in section 4.6.1, BoringSSL releases session tickets in Application Data (along with Finished) early, based on a precalculated client Finished transcript, once client signalled early data in extensions. --- src/event/quic/ngx_event_quic_output.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/event/quic/ngx_event_quic_output.c b/src/event/quic/ngx_event_quic_output.c index 72a678c3d..b72d3319e 100644 --- a/src/event/quic/ngx_event_quic_output.c +++ b/src/event/quic/ngx_event_quic_output.c @@ -476,6 +476,7 @@ ngx_quic_send_segments(ngx_connection_t *c, u_char *buf, size_t len, static ngx_uint_t ngx_quic_get_padding_level(ngx_connection_t *c) { + ngx_uint_t i; ngx_queue_t *q; ngx_quic_frame_t *f; ngx_quic_send_ctx_t *ctx; @@ -499,13 +500,15 @@ ngx_quic_get_padding_level(ngx_connection_t *c) f = ngx_queue_data(q, ngx_quic_frame_t, queue); if (f->need_ack) { - ctx = ngx_quic_get_send_ctx(qc, ssl_encryption_handshake); + for (i = 0; i + 1 < NGX_QUIC_SEND_CTX_LAST; i++) { + ctx = &qc->send_ctx[i + 1]; - if (ngx_queue_empty(&ctx->frames)) { - return 0; + if (ngx_queue_empty(&ctx->frames)) { + break; + } } - return 1; + return i; } }