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.
This commit is contained in:
Roman Arutyunyan 2022-02-03 21:29:05 +03:00
parent 2e7f031ba8
commit 89b9a30c3c
1 changed files with 4 additions and 4 deletions

View File

@ -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) {