Mercurial > hg > nginx
comparison src/event/quic/ngx_event_quic_ack.c @ 9193:ce1ff81e9b92
QUIC: ngx_quic_frame_t time fields cleanup.
The field "first" is removed. It's unused since 909b989ec088.
The field "last" is renamed to "send_time". It holds frame send time.
author | Roman Arutyunyan <arut@nginx.com> |
---|---|
date | Thu, 30 Nov 2023 15:03:06 +0400 |
parents | efcdaa66df2e |
children | 6c8595b77e66 |
comparison
equal
deleted
inserted
replaced
9192:efcdaa66df2e | 9193:ce1ff81e9b92 |
---|---|
263 ngx_quic_handle_stream_ack(c, f); | 263 ngx_quic_handle_stream_ack(c, f); |
264 break; | 264 break; |
265 } | 265 } |
266 | 266 |
267 if (f->pnum == max) { | 267 if (f->pnum == max) { |
268 st->max_pn = f->last; | 268 st->max_pn = f->send_time; |
269 } | 269 } |
270 | 270 |
271 /* save earliest and latest send times of frames ack'ed */ | 271 /* save earliest and latest send times of frames ack'ed */ |
272 if (st->oldest == NGX_TIMER_INFINITE || f->last < st->oldest) { | 272 if (st->oldest == NGX_TIMER_INFINITE || f->send_time < st->oldest) { |
273 st->oldest = f->last; | 273 st->oldest = f->send_time; |
274 } | 274 } |
275 | 275 |
276 if (st->newest == NGX_TIMER_INFINITE || f->last > st->newest) { | 276 if (st->newest == NGX_TIMER_INFINITE || f->send_time > st->newest) { |
277 st->newest = f->last; | 277 st->newest = f->send_time; |
278 } | 278 } |
279 | 279 |
280 ngx_queue_remove(&f->queue); | 280 ngx_queue_remove(&f->queue); |
281 ngx_quic_free_frame(c, f); | 281 ngx_quic_free_frame(c, f); |
282 found = 1; | 282 found = 1; |
327 | 327 |
328 blocked = (cg->in_flight >= cg->window) ? 1 : 0; | 328 blocked = (cg->in_flight >= cg->window) ? 1 : 0; |
329 | 329 |
330 cg->in_flight -= f->plen; | 330 cg->in_flight -= f->plen; |
331 | 331 |
332 timer = f->last - cg->recovery_start; | 332 timer = f->send_time - cg->recovery_start; |
333 | 333 |
334 if ((ngx_msec_int_t) timer <= 0) { | 334 if ((ngx_msec_int_t) timer <= 0) { |
335 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0, | 335 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0, |
336 "quic congestion ack recovery win:%uz ss:%z if:%uz", | 336 "quic congestion ack recovery win:%uz ss:%z if:%uz", |
337 cg->window, cg->ssthresh, cg->in_flight); | 337 cg->window, cg->ssthresh, cg->in_flight); |
463 | 463 |
464 if (start->pnum > ctx->largest_ack) { | 464 if (start->pnum > ctx->largest_ack) { |
465 break; | 465 break; |
466 } | 466 } |
467 | 467 |
468 wait = start->last + thr - now; | 468 wait = start->send_time + thr - now; |
469 | 469 |
470 ngx_log_debug4(NGX_LOG_DEBUG_EVENT, c->log, 0, | 470 ngx_log_debug4(NGX_LOG_DEBUG_EVENT, c->log, 0, |
471 "quic detect_lost pnum:%uL thr:%M wait:%i level:%d", | 471 "quic detect_lost pnum:%uL thr:%M wait:%i level:%d", |
472 start->pnum, thr, (ngx_int_t) wait, start->level); | 472 start->pnum, thr, (ngx_int_t) wait, start->level); |
473 | 473 |
475 && ctx->largest_ack - start->pnum < NGX_QUIC_PKT_THR) | 475 && ctx->largest_ack - start->pnum < NGX_QUIC_PKT_THR) |
476 { | 476 { |
477 break; | 477 break; |
478 } | 478 } |
479 | 479 |
480 if (start->last > qc->first_rtt) { | 480 if (start->send_time > qc->first_rtt) { |
481 | 481 |
482 if (oldest == NGX_TIMER_INFINITE || start->last < oldest) { | 482 if (oldest == NGX_TIMER_INFINITE || start->send_time < oldest) { |
483 oldest = start->last; | 483 oldest = start->send_time; |
484 } | 484 } |
485 | 485 |
486 if (newest == NGX_TIMER_INFINITE || start->last > newest) { | 486 if (newest == NGX_TIMER_INFINITE || start->send_time > newest) { |
487 newest = start->last; | 487 newest = start->send_time; |
488 } | 488 } |
489 | 489 |
490 nlost++; | 490 nlost++; |
491 } | 491 } |
492 | 492 |
670 blocked = (cg->in_flight >= cg->window) ? 1 : 0; | 670 blocked = (cg->in_flight >= cg->window) ? 1 : 0; |
671 | 671 |
672 cg->in_flight -= f->plen; | 672 cg->in_flight -= f->plen; |
673 f->plen = 0; | 673 f->plen = 0; |
674 | 674 |
675 timer = f->last - cg->recovery_start; | 675 timer = f->send_time - cg->recovery_start; |
676 | 676 |
677 if ((ngx_msec_int_t) timer <= 0) { | 677 if ((ngx_msec_int_t) timer <= 0) { |
678 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0, | 678 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0, |
679 "quic congestion lost recovery win:%uz ss:%z if:%uz", | 679 "quic congestion lost recovery win:%uz ss:%z if:%uz", |
680 cg->window, cg->ssthresh, cg->in_flight); | 680 cg->window, cg->ssthresh, cg->in_flight); |
728 } | 728 } |
729 | 729 |
730 if (ctx->largest_ack != NGX_QUIC_UNSET_PN) { | 730 if (ctx->largest_ack != NGX_QUIC_UNSET_PN) { |
731 q = ngx_queue_head(&ctx->sent); | 731 q = ngx_queue_head(&ctx->sent); |
732 f = ngx_queue_data(q, ngx_quic_frame_t, queue); | 732 f = ngx_queue_data(q, ngx_quic_frame_t, queue); |
733 w = (ngx_msec_int_t) (f->last + ngx_quic_lost_threshold(qc) - now); | 733 w = (ngx_msec_int_t) |
734 (f->send_time + ngx_quic_lost_threshold(qc) - now); | |
734 | 735 |
735 if (f->pnum <= ctx->largest_ack) { | 736 if (f->pnum <= ctx->largest_ack) { |
736 if (w < 0 || ctx->largest_ack - f->pnum >= NGX_QUIC_PKT_THR) { | 737 if (w < 0 || ctx->largest_ack - f->pnum >= NGX_QUIC_PKT_THR) { |
737 w = 0; | 738 w = 0; |
738 } | 739 } |
743 } | 744 } |
744 } | 745 } |
745 | 746 |
746 q = ngx_queue_last(&ctx->sent); | 747 q = ngx_queue_last(&ctx->sent); |
747 f = ngx_queue_data(q, ngx_quic_frame_t, queue); | 748 f = ngx_queue_data(q, ngx_quic_frame_t, queue); |
748 w = (ngx_msec_int_t) (f->last + (ngx_quic_pto(c, ctx) << qc->pto_count) | 749 w = (ngx_msec_int_t) |
749 - now); | 750 (f->send_time + (ngx_quic_pto(c, ctx) << qc->pto_count) - now); |
750 | 751 |
751 if (w < 0) { | 752 if (w < 0) { |
752 w = 0; | 753 w = 0; |
753 } | 754 } |
754 | 755 |
826 ngx_quic_pto_handler(ngx_event_t *ev) | 827 ngx_quic_pto_handler(ngx_event_t *ev) |
827 { | 828 { |
828 ngx_uint_t i, n; | 829 ngx_uint_t i, n; |
829 ngx_msec_t now; | 830 ngx_msec_t now; |
830 ngx_queue_t *q; | 831 ngx_queue_t *q; |
832 ngx_msec_int_t w; | |
831 ngx_connection_t *c; | 833 ngx_connection_t *c; |
832 ngx_quic_frame_t *f; | 834 ngx_quic_frame_t *f; |
833 ngx_quic_send_ctx_t *ctx; | 835 ngx_quic_send_ctx_t *ctx; |
834 ngx_quic_connection_t *qc; | 836 ngx_quic_connection_t *qc; |
835 | 837 |
847 continue; | 849 continue; |
848 } | 850 } |
849 | 851 |
850 q = ngx_queue_last(&ctx->sent); | 852 q = ngx_queue_last(&ctx->sent); |
851 f = ngx_queue_data(q, ngx_quic_frame_t, queue); | 853 f = ngx_queue_data(q, ngx_quic_frame_t, queue); |
854 w = (ngx_msec_int_t) | |
855 (f->send_time + (ngx_quic_pto(c, ctx) << qc->pto_count) - now); | |
852 | 856 |
853 if (f->pnum <= ctx->largest_ack | 857 if (f->pnum <= ctx->largest_ack |
854 && ctx->largest_ack != NGX_QUIC_UNSET_PN) | 858 && ctx->largest_ack != NGX_QUIC_UNSET_PN) |
855 { | 859 { |
856 continue; | 860 continue; |
857 } | 861 } |
858 | 862 |
859 if ((ngx_msec_int_t) (f->last + (ngx_quic_pto(c, ctx) << qc->pto_count) | 863 if (w > 0) { |
860 - now) > 0) | |
861 { | |
862 continue; | 864 continue; |
863 } | 865 } |
864 | 866 |
865 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, c->log, 0, | 867 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, c->log, 0, |
866 "quic pto %s pto_count:%ui", | 868 "quic pto %s pto_count:%ui", |