changeset 8663:1823e2152fc4 quic

QUIC: always calculate rtt for largest acknowledged packet. 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.
author Roman Arutyunyan <arut@nginx.com>
date Wed, 09 Dec 2020 21:26:21 +0000
parents b9ac4752d0e6
children f61d347158d0
files src/event/ngx_event_quic.c
diffstat 1 files changed, 1 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/event/ngx_event_quic.c
+++ b/src/event/ngx_event_quic.c
@@ -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_conn
 
     *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_conn
                 break;
             }
 
-            if (f->pnum > found_num || !found) {
+            if (f->pnum == max) {
                 *send_time = f->last;
-                found_num = f->pnum;
             }
 
             ngx_queue_remove(&f->queue);