Mercurial > hg > nginx
comparison src/event/quic/ngx_event_quic_frames.c @ 8967:3789f4a56d65 quic
QUIC: return written size from ngx_quic_write_chain().
This allows to escape calculating it before calling the function.
author | Roman Arutyunyan <arut@nginx.com> |
---|---|
date | Thu, 13 Jan 2022 11:34:42 +0300 |
parents | 5acd0d89d8c2 |
children | 065c73221b7b |
comparison
equal
deleted
inserted
replaced
8966:6f8253673669 | 8967:3789f4a56d65 |
---|---|
476 } | 476 } |
477 | 477 |
478 | 478 |
479 ngx_chain_t * | 479 ngx_chain_t * |
480 ngx_quic_write_chain(ngx_connection_t *c, ngx_chain_t **chain, ngx_chain_t *in, | 480 ngx_quic_write_chain(ngx_connection_t *c, ngx_chain_t **chain, ngx_chain_t *in, |
481 off_t limit, off_t offset) | 481 off_t limit, off_t offset, size_t *size) |
482 { | 482 { |
483 off_t n; | 483 off_t n; |
484 u_char *p; | 484 u_char *p; |
485 ngx_buf_t *b; | 485 ngx_buf_t *b; |
486 ngx_chain_t *cl, *sl; | 486 ngx_chain_t *cl, *sl; |
487 | 487 |
488 if (size) { | |
489 *size = 0; | |
490 } | |
491 | |
488 while (in && limit) { | 492 while (in && limit) { |
489 cl = *chain; | 493 cl = *chain; |
490 | 494 |
491 if (cl == NULL) { | 495 if (cl == NULL) { |
492 cl = ngx_quic_alloc_chain(c); | 496 cl = ngx_quic_alloc_chain(c); |
547 | 551 |
548 p += n; | 552 p += n; |
549 in->buf->pos += n; | 553 in->buf->pos += n; |
550 offset += n; | 554 offset += n; |
551 limit -= n; | 555 limit -= n; |
556 | |
557 if (size) { | |
558 *size += n; | |
559 } | |
552 } | 560 } |
553 | 561 |
554 if (b->sync && p == b->last) { | 562 if (b->sync && p == b->last) { |
555 b->sync = 0; | 563 b->sync = 0; |
556 continue; | 564 continue; |