comparison src/event/ngx_event_quic.c @ 8612:b1676cd64dc9 quic

QUIC: cleanup send context properly. The patch resets ctx->frames queue, which may contain frames. It was possible that congestion or amplification limits prevented all frames to be sent. Retransmitted frames could be accounted twice as inflight: first time in ngx_quic_congestion_lost() called from ngx_quic_resend_frames(), and later from ngx_quic_discard_ctx().
author Vladimir Homutov <vl@nginx.com>
date Tue, 27 Oct 2020 00:14:24 +0300
parents e2086d8181fa
children 867c189f875d
comparison
equal deleted inserted replaced
8611:e2086d8181fa 8612:b1676cd64dc9
2252 f = ngx_queue_data(q, ngx_quic_frame_t, queue); 2252 f = ngx_queue_data(q, ngx_quic_frame_t, queue);
2253 ngx_quic_congestion_ack(c, f); 2253 ngx_quic_congestion_ack(c, f);
2254 ngx_quic_free_frame(c, f); 2254 ngx_quic_free_frame(c, f);
2255 } 2255 }
2256 2256
2257 while (!ngx_queue_empty(&ctx->frames)) {
2258 q = ngx_queue_head(&ctx->frames);
2259 ngx_queue_remove(q);
2260
2261 f = ngx_queue_data(q, ngx_quic_frame_t, queue);
2262 ngx_quic_congestion_ack(c, f);
2263 ngx_quic_free_frame(c, f);
2264 }
2265
2257 ctx->send_ack = 0; 2266 ctx->send_ack = 0;
2258 } 2267 }
2259 2268
2260 2269
2261 static ngx_int_t 2270 static ngx_int_t
5675 5684
5676 qc = c->quic; 5685 qc = c->quic;
5677 cg = &qc->congestion; 5686 cg = &qc->congestion;
5678 5687
5679 cg->in_flight -= f->plen; 5688 cg->in_flight -= f->plen;
5689 f->plen = 0;
5680 5690
5681 timer = f->last - cg->recovery_start; 5691 timer = f->last - cg->recovery_start;
5682 5692
5683 if ((ngx_msec_int_t) timer <= 0) { 5693 if ((ngx_msec_int_t) timer <= 0) {
5684 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0, 5694 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0,