Mercurial > hg > nginx
comparison src/event/quic/ngx_event_quic_frames.c @ 8949:2e22110828dd quic
QUIC: removed ngx_quic_copy_chain().
The function is unused.
author | Roman Arutyunyan <arut@nginx.com> |
---|---|
date | Thu, 16 Dec 2021 17:07:11 +0300 |
parents | 19e063e955bf |
children | fb811b6c76ee |
comparison
equal
deleted
inserted
replaced
8948:19e063e955bf | 8949:2e22110828dd |
---|---|
429 return out; | 429 return out; |
430 } | 430 } |
431 | 431 |
432 | 432 |
433 ngx_chain_t * | 433 ngx_chain_t * |
434 ngx_quic_copy_chain(ngx_connection_t *c, ngx_chain_t *in, size_t limit) | |
435 { | |
436 size_t n; | |
437 ngx_buf_t *b; | |
438 ngx_chain_t *cl, *out, **ll; | |
439 | |
440 out = NULL; | |
441 ll = &out; | |
442 | |
443 while (in) { | |
444 if (!ngx_buf_in_memory(in->buf) || ngx_buf_size(in->buf) == 0) { | |
445 in = in->next; | |
446 continue; | |
447 } | |
448 | |
449 cl = ngx_quic_alloc_chain(c); | |
450 if (cl == NULL) { | |
451 return NGX_CHAIN_ERROR; | |
452 } | |
453 | |
454 *ll = cl; | |
455 ll = &cl->next; | |
456 | |
457 b = cl->buf; | |
458 | |
459 while (in && b->last != b->end) { | |
460 | |
461 n = ngx_min(in->buf->last - in->buf->pos, b->end - b->last); | |
462 | |
463 if (limit > 0 && n > limit) { | |
464 n = limit; | |
465 } | |
466 | |
467 b->last = ngx_cpymem(b->last, in->buf->pos, n); | |
468 | |
469 in->buf->pos += n; | |
470 if (in->buf->pos == in->buf->last) { | |
471 in = in->next; | |
472 } | |
473 | |
474 if (limit > 0) { | |
475 if (limit == n) { | |
476 goto done; | |
477 } | |
478 | |
479 limit -= n; | |
480 } | |
481 } | |
482 } | |
483 | |
484 done: | |
485 | |
486 *ll = NULL; | |
487 | |
488 return out; | |
489 } | |
490 | |
491 | |
492 ngx_chain_t * | |
493 ngx_quic_write_chain(ngx_connection_t *c, ngx_chain_t **chain, ngx_chain_t *in, | 434 ngx_quic_write_chain(ngx_connection_t *c, ngx_chain_t **chain, ngx_chain_t *in, |
494 off_t limit, off_t offset) | 435 off_t limit, off_t offset) |
495 { | 436 { |
496 off_t n; | 437 off_t n; |
497 u_char *p; | 438 u_char *p; |