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.
This commit is contained in:
parent
4ce2114724
commit
c5f5a571d9
|
@ -53,7 +53,7 @@ typedef struct {
|
|||
uint64_t offset;
|
||||
uint64_t last_offset;
|
||||
ngx_chain_t *chain;
|
||||
ngx_chain_t **last_chain;
|
||||
ngx_chain_t *last_chain;
|
||||
} ngx_quic_buffer_t;
|
||||
|
||||
|
||||
|
|
|
@ -503,7 +503,7 @@ ngx_quic_write_buffer(ngx_connection_t *c, ngx_quic_buffer_t *qb,
|
|||
|
||||
if (qb->last_chain && offset >= qb->last_offset) {
|
||||
base = qb->last_offset;
|
||||
chain = qb->last_chain;
|
||||
chain = &qb->last_chain;
|
||||
|
||||
} else {
|
||||
base = qb->offset;
|
||||
|
@ -600,7 +600,7 @@ ngx_quic_write_buffer(ngx_connection_t *c, ngx_quic_buffer_t *qb,
|
|||
}
|
||||
|
||||
qb->last_offset = base;
|
||||
qb->last_chain = chain;
|
||||
qb->last_chain = *chain;
|
||||
|
||||
return in;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue