changeset 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
files src/event/ngx_event_quic.c
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/event/ngx_event_quic.c	Tue Oct 27 00:00:56 2020 +0300
+++ b/src/event/ngx_event_quic.c	Tue Oct 27 00:14:24 2020 +0300
@@ -2254,6 +2254,15 @@
         ngx_quic_free_frame(c, f);
     }
 
+    while (!ngx_queue_empty(&ctx->frames)) {
+        q = ngx_queue_head(&ctx->frames);
+        ngx_queue_remove(q);
+
+        f = ngx_queue_data(q, ngx_quic_frame_t, queue);
+        ngx_quic_congestion_ack(c, f);
+        ngx_quic_free_frame(c, f);
+    }
+
     ctx->send_ack = 0;
 }
 
@@ -5677,6 +5686,7 @@
     cg = &qc->congestion;
 
     cg->in_flight -= f->plen;
+    f->plen = 0;
 
     timer = f->last - cg->recovery_start;