Mercurial > hg > nginx
comparison src/event/quic/ngx_event_quic_ssl.c @ 8947:6ccf3867959a quic
QUIC: refactored ngx_quic_order_bufs() and ngx_quic_split_bufs().
They are replaced with ngx_quic_write_chain() and ngx_quic_read_chain().
These functions represent the API to data buffering.
The first function adds data of given size at given offset to the buffer.
Now it returns the unwritten part of the chain similar to c->send_chain().
The second function returns data of given size from the beginning of the buffer.
Its second argument and return value are swapped compared to
ngx_quic_split_bufs() to better match ngx_quic_write_chain().
Added, returned and stored data are regular ngx_chain_t/ngx_buf_t chains.
Missing data is marked with b->sync flag.
The functions are now used in both send and recv data chains in QUIC streams.
author | Roman Arutyunyan <arut@nginx.com> |
---|---|
date | Fri, 24 Dec 2021 18:17:23 +0300 |
parents | 56dec0d4e5b1 |
children | 19e063e955bf |
comparison
equal
deleted
inserted
replaced
8946:56dec0d4e5b1 | 8947:6ccf3867959a |
---|---|
367 | 367 |
368 return NGX_OK; | 368 return NGX_OK; |
369 } | 369 } |
370 | 370 |
371 if (f->offset > ctx->crypto_received) { | 371 if (f->offset > ctx->crypto_received) { |
372 return ngx_quic_order_bufs(c, &ctx->crypto, frame->data, f->length, | 372 if (ngx_quic_write_chain(c, &ctx->crypto, frame->data, f->length, |
373 f->offset - ctx->crypto_received); | 373 f->offset - ctx->crypto_received) |
374 == NGX_CHAIN_ERROR) | |
375 { | |
376 return NGX_ERROR; | |
377 } | |
378 | |
379 return NGX_OK; | |
374 } | 380 } |
375 | 381 |
376 ngx_quic_trim_bufs(frame->data, ctx->crypto_received - f->offset); | 382 ngx_quic_trim_bufs(frame->data, ctx->crypto_received - f->offset); |
377 | 383 |
378 if (ngx_quic_crypto_input(c, frame->data) != NGX_OK) { | 384 if (ngx_quic_crypto_input(c, frame->data) != NGX_OK) { |