Mercurial > hg > nginx
comparison 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 |
comparison
equal
deleted
inserted
replaced
9001:868e1b76c956 | 9002:740e8b99519d |
---|---|
552 n = ngx_min(b->last - p, in->buf->last - in->buf->pos); | 552 n = ngx_min(b->last - p, in->buf->last - in->buf->pos); |
553 n = ngx_min(n, limit); | 553 n = ngx_min(n, limit); |
554 | 554 |
555 if (b->sync) { | 555 if (b->sync) { |
556 ngx_memcpy(p, in->buf->pos, n); | 556 ngx_memcpy(p, in->buf->pos, n); |
557 | |
558 if (size) { | |
559 *size += n; | |
560 } | |
557 } | 561 } |
558 | 562 |
559 p += n; | 563 p += n; |
560 in->buf->pos += n; | 564 in->buf->pos += n; |
561 offset += n; | 565 offset += n; |
562 limit -= n; | 566 limit -= n; |
563 | |
564 if (size) { | |
565 *size += n; | |
566 } | |
567 } | 567 } |
568 | 568 |
569 if (b->sync && p == b->last) { | 569 if (b->sync && p == b->last) { |
570 b->sync = 0; | 570 b->sync = 0; |
571 continue; | 571 continue; |