comparison src/event/ngx_event_quic.c @ 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 b14338acbf9d
comparison
equal deleted inserted replaced
8662:b9ac4752d0e6 8663:1823e2152fc4
3274 3274
3275 static ngx_int_t 3275 static ngx_int_t
3276 ngx_quic_handle_ack_frame_range(ngx_connection_t *c, ngx_quic_send_ctx_t *ctx, 3276 ngx_quic_handle_ack_frame_range(ngx_connection_t *c, ngx_quic_send_ctx_t *ctx,
3277 uint64_t min, uint64_t max, ngx_msec_t *send_time) 3277 uint64_t min, uint64_t max, ngx_msec_t *send_time)
3278 { 3278 {
3279 uint64_t found_num;
3280 ngx_uint_t found; 3279 ngx_uint_t found;
3281 ngx_queue_t *q; 3280 ngx_queue_t *q;
3282 ngx_quic_frame_t *f; 3281 ngx_quic_frame_t *f;
3283 ngx_quic_connection_t *qc; 3282 ngx_quic_connection_t *qc;
3284 3283
3285 qc = ngx_quic_get_connection(c); 3284 qc = ngx_quic_get_connection(c);
3286 3285
3287 *send_time = NGX_TIMER_INFINITE; 3286 *send_time = NGX_TIMER_INFINITE;
3288 found = 0; 3287 found = 0;
3289 found_num = 0;
3290 3288
3291 q = ngx_queue_last(&ctx->sent); 3289 q = ngx_queue_last(&ctx->sent);
3292 3290
3293 while (q != ngx_queue_sentinel(&ctx->sent)) { 3291 while (q != ngx_queue_sentinel(&ctx->sent)) {
3294 3292
3314 case NGX_QUIC_FT_STREAM7: 3312 case NGX_QUIC_FT_STREAM7:
3315 ngx_quic_handle_stream_ack(c, f); 3313 ngx_quic_handle_stream_ack(c, f);
3316 break; 3314 break;
3317 } 3315 }
3318 3316
3319 if (f->pnum > found_num || !found) { 3317 if (f->pnum == max) {
3320 *send_time = f->last; 3318 *send_time = f->last;
3321 found_num = f->pnum;
3322 } 3319 }
3323 3320
3324 ngx_queue_remove(&f->queue); 3321 ngx_queue_remove(&f->queue);
3325 ngx_quic_free_frame(c, f); 3322 ngx_quic_free_frame(c, f);
3326 found = 1; 3323 found = 1;