QUIC: renamed buffer-related functions.

ngx_quic_alloc_buf() -> ngx_quic_alloc_chain(),
ngx_quic_free_bufs() -> ngx_quic_free_chain(),
ngx_quic_trim_bufs() -> ngx_quic_trim_chain()
This commit is contained in:
Roman Arutyunyan 2021-12-16 17:06:35 +03:00
parent baea97bc54
commit 4d79f94221
6 changed files with 20 additions and 20 deletions

View File

@ -1085,7 +1085,7 @@ ngx_quic_discard_ctx(ngx_connection_t *c, enum ssl_encryption_level_t level)
ctx = ngx_quic_get_send_ctx(qc, level); ctx = ngx_quic_get_send_ctx(qc, level);
ngx_quic_free_bufs(c, ctx->crypto); ngx_quic_free_chain(c, ctx->crypto);
while (!ngx_queue_empty(&ctx->sent)) { while (!ngx_queue_empty(&ctx->sent)) {
q = ngx_queue_head(&ctx->sent); q = ngx_queue_head(&ctx->sent);

View File

@ -66,7 +66,7 @@ ngx_quic_free_frame(ngx_connection_t *c, ngx_quic_frame_t *frame)
qc = ngx_quic_get_connection(c); qc = ngx_quic_get_connection(c);
if (frame->data) { if (frame->data) {
ngx_quic_free_bufs(c, frame->data); ngx_quic_free_chain(c, frame->data);
} }
ngx_queue_insert_head(&qc->free_frames, &frame->queue); ngx_queue_insert_head(&qc->free_frames, &frame->queue);
@ -79,7 +79,7 @@ ngx_quic_free_frame(ngx_connection_t *c, ngx_quic_frame_t *frame)
void void
ngx_quic_trim_bufs(ngx_chain_t *in, size_t size) ngx_quic_trim_chain(ngx_chain_t *in, size_t size)
{ {
size_t n; size_t n;
ngx_buf_t *b; ngx_buf_t *b;
@ -99,7 +99,7 @@ ngx_quic_trim_bufs(ngx_chain_t *in, size_t size)
void void
ngx_quic_free_bufs(ngx_connection_t *c, ngx_chain_t *in) ngx_quic_free_chain(ngx_connection_t *c, ngx_chain_t *in)
{ {
ngx_buf_t *b, *shadow; ngx_buf_t *b, *shadow;
ngx_chain_t *cl; ngx_chain_t *cl;
@ -347,7 +347,7 @@ split:
ngx_chain_t * ngx_chain_t *
ngx_quic_alloc_buf(ngx_connection_t *c) ngx_quic_alloc_chain(ngx_connection_t *c)
{ {
ngx_buf_t *b; ngx_buf_t *b;
ngx_chain_t *cl; ngx_chain_t *cl;
@ -381,7 +381,7 @@ ngx_quic_alloc_buf(ngx_connection_t *c)
return NULL; return NULL;
} }
b->tag = (ngx_buf_tag_t) &ngx_quic_alloc_buf; b->tag = (ngx_buf_tag_t) &ngx_quic_alloc_chain;
cl->buf = b; cl->buf = b;
@ -407,7 +407,7 @@ ngx_quic_copy_buf(ngx_connection_t *c, u_char *data, size_t len)
ll = &out; ll = &out;
while (len) { while (len) {
cl = ngx_quic_alloc_buf(c); cl = ngx_quic_alloc_chain(c);
if (cl == NULL) { if (cl == NULL) {
return NGX_CHAIN_ERROR; return NGX_CHAIN_ERROR;
} }
@ -446,7 +446,7 @@ ngx_quic_copy_chain(ngx_connection_t *c, ngx_chain_t *in, size_t limit)
continue; continue;
} }
cl = ngx_quic_alloc_buf(c); cl = ngx_quic_alloc_chain(c);
if (cl == NULL) { if (cl == NULL) {
return NGX_CHAIN_ERROR; return NGX_CHAIN_ERROR;
} }
@ -502,7 +502,7 @@ ngx_quic_write_chain(ngx_connection_t *c, ngx_chain_t **chain, ngx_chain_t *in,
cl = *chain; cl = *chain;
if (cl == NULL) { if (cl == NULL) {
cl = ngx_quic_alloc_buf(c); cl = ngx_quic_alloc_chain(c);
if (cl == NULL) { if (cl == NULL) {
return NGX_CHAIN_ERROR; return NGX_CHAIN_ERROR;
} }

View File

@ -23,13 +23,13 @@ void ngx_quic_queue_frame(ngx_quic_connection_t *qc, ngx_quic_frame_t *frame);
ngx_int_t ngx_quic_split_frame(ngx_connection_t *c, ngx_quic_frame_t *f, ngx_int_t ngx_quic_split_frame(ngx_connection_t *c, ngx_quic_frame_t *f,
size_t len); size_t len);
ngx_chain_t *ngx_quic_alloc_buf(ngx_connection_t *c); ngx_chain_t *ngx_quic_alloc_chain(ngx_connection_t *c);
ngx_chain_t *ngx_quic_copy_buf(ngx_connection_t *c, u_char *data, ngx_chain_t *ngx_quic_copy_buf(ngx_connection_t *c, u_char *data,
size_t len); size_t len);
ngx_chain_t *ngx_quic_copy_chain(ngx_connection_t *c, ngx_chain_t *in, ngx_chain_t *ngx_quic_copy_chain(ngx_connection_t *c, ngx_chain_t *in,
size_t limit); size_t limit);
void ngx_quic_trim_bufs(ngx_chain_t *in, size_t size); void ngx_quic_trim_chain(ngx_chain_t *in, size_t size);
void ngx_quic_free_bufs(ngx_connection_t *c, ngx_chain_t *in); void ngx_quic_free_chain(ngx_connection_t *c, ngx_chain_t *in);
ngx_chain_t *ngx_quic_read_chain(ngx_connection_t *c, ngx_chain_t **chain, ngx_chain_t *ngx_quic_read_chain(ngx_connection_t *c, ngx_chain_t **chain,
off_t limit); off_t limit);
ngx_chain_t *ngx_quic_write_chain(ngx_connection_t *c, ngx_chain_t **chain, ngx_chain_t *ngx_quic_write_chain(ngx_connection_t *c, ngx_chain_t **chain,

View File

@ -1121,7 +1121,7 @@ ngx_quic_send_ack(ngx_connection_t *c, ngx_quic_send_ctx_t *ctx)
left = b ? b->end - b->last : 0; left = b ? b->end - b->last : 0;
if (left < len) { if (left < len) {
cl = ngx_quic_alloc_buf(c); cl = ngx_quic_alloc_chain(c);
if (cl == NULL) { if (cl == NULL) {
return NGX_ERROR; return NGX_ERROR;
} }

View File

@ -379,13 +379,13 @@ ngx_quic_handle_crypto_frame(ngx_connection_t *c, ngx_quic_header_t *pkt,
return NGX_OK; return NGX_OK;
} }
ngx_quic_trim_bufs(frame->data, ctx->crypto_received - f->offset); ngx_quic_trim_chain(frame->data, ctx->crypto_received - f->offset);
if (ngx_quic_crypto_input(c, frame->data) != NGX_OK) { if (ngx_quic_crypto_input(c, frame->data) != NGX_OK) {
return NGX_ERROR; return NGX_ERROR;
} }
ngx_quic_trim_bufs(ctx->crypto, last - ctx->crypto_received); ngx_quic_trim_chain(ctx->crypto, last - ctx->crypto_received);
ctx->crypto_received = last; ctx->crypto_received = last;
cl = ctx->crypto; cl = ctx->crypto;
@ -413,7 +413,7 @@ ngx_quic_handle_crypto_frame(ngx_connection_t *c, ngx_quic_header_t *pkt,
return NGX_ERROR; return NGX_ERROR;
} }
ngx_quic_free_bufs(c, cl); ngx_quic_free_chain(c, cl);
} }
return NGX_OK; return NGX_OK;

View File

@ -777,7 +777,7 @@ ngx_quic_stream_recv(ngx_connection_t *c, u_char *buf, size_t size)
buf = ngx_cpymem(buf, b->pos, b->last - b->pos); buf = ngx_cpymem(buf, b->pos, b->last - b->pos);
} }
ngx_quic_free_bufs(pc, in); ngx_quic_free_chain(pc, in);
if (qs->in == NULL) { if (qs->in == NULL) {
rev->ready = rev->pending_eof; rev->ready = rev->pending_eof;
@ -975,8 +975,8 @@ ngx_quic_stream_cleanup_handler(void *data)
"quic stream id:0x%xL cleanup", qs->id); "quic stream id:0x%xL cleanup", qs->id);
ngx_rbtree_delete(&qc->streams.tree, &qs->node); ngx_rbtree_delete(&qc->streams.tree, &qs->node);
ngx_quic_free_bufs(pc, qs->in); ngx_quic_free_chain(pc, qs->in);
ngx_quic_free_bufs(pc, qs->out); ngx_quic_free_chain(pc, qs->out);
if (qc->closing) { if (qc->closing) {
/* schedule handler call to continue ngx_quic_close_connection() */ /* schedule handler call to continue ngx_quic_close_connection() */
@ -1079,7 +1079,7 @@ ngx_quic_handle_stream_frame(ngx_connection_t *c, ngx_quic_header_t *pkt,
} }
if (f->offset < qs->recv_offset) { if (f->offset < qs->recv_offset) {
ngx_quic_trim_bufs(frame->data, qs->recv_offset - f->offset); ngx_quic_trim_chain(frame->data, qs->recv_offset - f->offset);
f->offset = qs->recv_offset; f->offset = qs->recv_offset;
} }