Mercurial > hg > nginx
comparison src/event/quic/ngx_event_quic.c @ 9007:2dc4203d812c quic
QUIC: fixed in-flight bytes accounting.
Initially, frames are genereated and stored in ctx->frames.
Next, ngx_quic_output() collects frames to be sent in in ctx->sending.
On failure, ngx_quic_revert_sned() returns frames into ctx->frames.
On success, the ngx_quic_commit_send() moves ack-eliciting frames into
ctx->sent and frees non-ack-eliciting frames.
This function also updates in-flight bytes counter, so only actually sent
frames are accounted.
The counter is decremented in the following cases:
- acknowledgment is received
- packet was declared lost
- we are discarding context completely
In each of this cases frame is removed from ctx->sent queue and in-flight
counter is accordingly decremented.
The patch fixes the case of discarding context - only removing frames
from ctx->sent must be followed by in-flight bytes counter decrement,
otherwise cg->in_flight could experience type underflow.
The issue appeared in b1676cd64dc9.
author | Vladimir Homutov <vl@nginx.com> |
---|---|
date | Wed, 09 Feb 2022 15:51:42 +0300 |
parents | 308ac307b3e6 |
children | a5aebd51e4c7 |
comparison
equal
deleted
inserted
replaced
9006:5f78174d1ac1 | 9007:2dc4203d812c |
---|---|
1090 while (!ngx_queue_empty(&ctx->frames)) { | 1090 while (!ngx_queue_empty(&ctx->frames)) { |
1091 q = ngx_queue_head(&ctx->frames); | 1091 q = ngx_queue_head(&ctx->frames); |
1092 ngx_queue_remove(q); | 1092 ngx_queue_remove(q); |
1093 | 1093 |
1094 f = ngx_queue_data(q, ngx_quic_frame_t, queue); | 1094 f = ngx_queue_data(q, ngx_quic_frame_t, queue); |
1095 ngx_quic_congestion_ack(c, f); | |
1096 ngx_quic_free_frame(c, f); | 1095 ngx_quic_free_frame(c, f); |
1097 } | 1096 } |
1098 | 1097 |
1099 if (level == ssl_encryption_initial) { | 1098 if (level == ssl_encryption_initial) { |
1100 /* close temporary listener with odcid */ | 1099 /* close temporary listener with odcid */ |