# HG changeset patch # User Roman Arutyunyan # Date 1643912945 -10800 # Node ID 740e8b99519d93ff4c379c0cc3840ddd9d907ac6 # Parent 868e1b76c95621dd77b17cb4557b5ec5b20227d9 QUIC: improved size calculation in ngx_quic_write_chain(). Previously, size was calculated based on the number of input bytes processed by the function. Now only the copied bytes are considered. This prevents overlapping buffers from contributing twice to the overall written size. diff --git a/src/event/quic/ngx_event_quic_frames.c b/src/event/quic/ngx_event_quic_frames.c --- a/src/event/quic/ngx_event_quic_frames.c +++ b/src/event/quic/ngx_event_quic_frames.c @@ -554,16 +554,16 @@ ngx_quic_write_chain(ngx_connection_t *c if (b->sync) { ngx_memcpy(p, in->buf->pos, n); + + if (size) { + *size += n; + } } p += n; in->buf->pos += n; offset += n; limit -= n; - - if (size) { - *size += n; - } } if (b->sync && p == b->last) {