aboutsummaryrefslogtreecommitdiff
path: root/src/event/quic/ngx_event_quic_frames.c
diff options
context:
space:
mode:
authorRoman Arutyunyan <arut@nginx.com>2022-01-13 11:34:42 +0300
committerRoman Arutyunyan <arut@nginx.com>2022-01-13 11:34:42 +0300
commit2ba20e3451ca5f31ad7a9811081b85d92472082c (patch)
tree6189530afc7367ea33d7ef5a9c6bc257f891073c /src/event/quic/ngx_event_quic_frames.c
parent2f28342e088b61e1605391ada79db703f047c5f2 (diff)
downloadnginx-2ba20e3451ca5f31ad7a9811081b85d92472082c.tar.gz
nginx-2ba20e3451ca5f31ad7a9811081b85d92472082c.zip
QUIC: return written size from ngx_quic_write_chain().
This allows to escape calculating it before calling the function.
Diffstat (limited to 'src/event/quic/ngx_event_quic_frames.c')
-rw-r--r--src/event/quic/ngx_event_quic_frames.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/event/quic/ngx_event_quic_frames.c b/src/event/quic/ngx_event_quic_frames.c
index 89bd6d236..55e58d329 100644
--- a/src/event/quic/ngx_event_quic_frames.c
+++ b/src/event/quic/ngx_event_quic_frames.c
@@ -478,13 +478,17 @@ ngx_quic_copy_buf(ngx_connection_t *c, u_char *data, size_t len)
ngx_chain_t *
ngx_quic_write_chain(ngx_connection_t *c, ngx_chain_t **chain, ngx_chain_t *in,
- off_t limit, off_t offset)
+ off_t limit, off_t offset, size_t *size)
{
off_t n;
u_char *p;
ngx_buf_t *b;
ngx_chain_t *cl, *sl;
+ if (size) {
+ *size = 0;
+ }
+
while (in && limit) {
cl = *chain;
@@ -549,6 +553,10 @@ ngx_quic_write_chain(ngx_connection_t *c, ngx_chain_t **chain, ngx_chain_t *in,
in->buf->pos += n;
offset += n;
limit -= n;
+
+ if (size) {
+ *size += n;
+ }
}
if (b->sync && p == b->last) {