]> git.kaiwu.me - nginx.git/commitdiff
QUIC: always calculate rtt for largest acknowledged packet.
authorRoman Arutyunyan <arut@nginx.com>
Wed, 9 Dec 2020 21:26:21 +0000 (21:26 +0000)
committerRoman Arutyunyan <arut@nginx.com>
Wed, 9 Dec 2020 21:26:21 +0000 (21:26 +0000)
Previously, when processing client ACK, rtt could be calculated for a packet
different than the largest if it was missing in the sent chain.  Even though
this is an unlikely situation, rtt based on a different packet could be larger
than needed leading to bigger pto timeout and performance degradation.

src/event/ngx_event_quic.c

index 349fbb3115e41e93e253696203dd70bef0c69775..73519b968c8f8a9aa822aad4553d61340d21f6b6 100644 (file)
@@ -3276,7 +3276,6 @@ static ngx_int_t
 ngx_quic_handle_ack_frame_range(ngx_connection_t *c, ngx_quic_send_ctx_t *ctx,
     uint64_t min, uint64_t max, ngx_msec_t *send_time)
 {
-    uint64_t                found_num;
     ngx_uint_t              found;
     ngx_queue_t            *q;
     ngx_quic_frame_t       *f;
@@ -3286,7 +3285,6 @@ ngx_quic_handle_ack_frame_range(ngx_connection_t *c, ngx_quic_send_ctx_t *ctx,
 
     *send_time = NGX_TIMER_INFINITE;
     found = 0;
-    found_num = 0;
 
     q = ngx_queue_last(&ctx->sent);
 
@@ -3316,9 +3314,8 @@ ngx_quic_handle_ack_frame_range(ngx_connection_t *c, ngx_quic_send_ctx_t *ctx,
                 break;
             }
 
-            if (f->pnum > found_num || !found) {
+            if (f->pnum == max) {
                 *send_time = f->last;
-                found_num = f->pnum;
             }
 
             ngx_queue_remove(&f->queue);