summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRoman Arutyunyan <arut@nginx.com>2022-02-03 21:29:05 +0300
committerRoman Arutyunyan <arut@nginx.com>2022-02-03 21:29:05 +0300
commit1cc2be9616bd9117778d3576dcf3112eb93da4e3 (patch)
treeb6841c7a0bcb11b67c5c7f9c44f1d25c2067251d
parent8a61c89a276ae5626ff84f6dd1e9da218754a313 (diff)
downloadnginx-1cc2be9616bd9117778d3576dcf3112eb93da4e3.tar.gz
nginx-1cc2be9616bd9117778d3576dcf3112eb93da4e3.tar.bz2
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.
-rw-r--r--src/event/quic/ngx_event_quic_frames.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/event/quic/ngx_event_quic_frames.c b/src/event/quic/ngx_event_quic_frames.c
index 951b6e8a2..4fa6c56c5 100644
--- 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, ngx_chain_t **chain, ngx_chain_t *in,
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) {