comparison src/event/quic/ngx_event_quic_frames.c @ 9016:55b38514729b quic

QUIC: fixed insertion at the end of buffer. Previously, last buffer was tracked by keeping a pointer to the previous chain link "next" field. When the previous buffer was split and then removed, the pointer was no longer valid. Writing at this pointer resulted in broken data chains. Now last buffer is tracked by keeping a direct pointer to it.
author Roman Arutyunyan <arut@nginx.com>
date Thu, 17 Feb 2022 22:38:42 +0300
parents 8d11e2171697
children 3c98fa8fef6f
comparison
equal deleted inserted replaced
9015:a2fbae359828 9016:55b38514729b
501 ngx_buf_t *b; 501 ngx_buf_t *b;
502 ngx_chain_t *cl, **chain; 502 ngx_chain_t *cl, **chain;
503 503
504 if (qb->last_chain && offset >= qb->last_offset) { 504 if (qb->last_chain && offset >= qb->last_offset) {
505 base = qb->last_offset; 505 base = qb->last_offset;
506 chain = qb->last_chain; 506 chain = &qb->last_chain;
507 507
508 } else { 508 } else {
509 base = qb->offset; 509 base = qb->offset;
510 chain = &qb->chain; 510 chain = &qb->chain;
511 } 511 }
598 b->sync = 0; 598 b->sync = 0;
599 } 599 }
600 } 600 }
601 601
602 qb->last_offset = base; 602 qb->last_offset = base;
603 qb->last_chain = chain; 603 qb->last_chain = *chain;
604 604
605 return in; 605 return in;
606 } 606 }
607 607
608 608