Mercurial > hg > nginx
comparison src/event/quic/ngx_event_quic_frames.c @ 9013:b5656025ddb5 quic
QUIC: eliminated ngx_quic_copy_buf().
Its only call is substituted with QUIC buffer write/read pair.
author | Roman Arutyunyan <arut@nginx.com> |
---|---|
date | Mon, 14 Feb 2022 14:53:46 +0300 |
parents | 489c2dcb3180 |
children | 8d11e2171697 |
comparison
equal
deleted
inserted
replaced
9012:489c2dcb3180 | 9013:b5656025ddb5 |
---|---|
483 return cl; | 483 return cl; |
484 } | 484 } |
485 | 485 |
486 | 486 |
487 ngx_chain_t * | 487 ngx_chain_t * |
488 ngx_quic_copy_buf(ngx_connection_t *c, u_char *data, size_t len) | |
489 { | |
490 size_t n; | |
491 ngx_buf_t *b; | |
492 ngx_chain_t *cl, *out, **ll; | |
493 | |
494 out = NULL; | |
495 ll = &out; | |
496 | |
497 while (len) { | |
498 cl = ngx_quic_alloc_chain(c); | |
499 if (cl == NULL) { | |
500 return NGX_CHAIN_ERROR; | |
501 } | |
502 | |
503 b = cl->buf; | |
504 n = ngx_min((size_t) (b->end - b->last), len); | |
505 | |
506 b->last = ngx_cpymem(b->last, data, n); | |
507 | |
508 data += n; | |
509 len -= n; | |
510 | |
511 *ll = cl; | |
512 ll = &cl->next; | |
513 } | |
514 | |
515 *ll = NULL; | |
516 | |
517 return out; | |
518 } | |
519 | |
520 | |
521 ngx_chain_t * | |
522 ngx_quic_write_buffer(ngx_connection_t *c, ngx_quic_buffer_t *qb, | 488 ngx_quic_write_buffer(ngx_connection_t *c, ngx_quic_buffer_t *qb, |
523 ngx_chain_t *in, uint64_t limit, uint64_t offset) | 489 ngx_chain_t *in, uint64_t limit, uint64_t offset) |
524 { | 490 { |
525 u_char *p; | 491 u_char *p; |
526 uint64_t n, base; | 492 uint64_t n, base; |