diff src/event/quic/ngx_event_quic_frames.c @ 9002:740e8b99519d quic

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.
author Roman Arutyunyan <arut@nginx.com>
date Thu, 03 Feb 2022 21:29:05 +0300
parents 000b9b048e0c
children a5aebd51e4c7
line wrap: on
line diff
--- 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) {