comparison src/event/quic/ngx_event_quic_ack.c @ 9081:52cddd44ec11 quic

QUIC: removed check for in-flight packets in computing PTO. The check is needed for clients in order to unblock a server due to anti-amplification limits, and it seems to make no sense for servers. See RFC 9002, A.6 and A.8 for a further explanation. This makes max_ack_delay to now always account, notably including PATH_CHALLENGE timers as noted in the last paragraph of 9000, 9.4, unlike when it was only used when there are packets in flight. While here, fixed nearby style.
author Sergey Kandaurov <pluknet@nginx.com>
date Tue, 09 May 2023 19:42:38 +0400
parents 2e51cf3ffd90
children c6db94ec3841
comparison
equal deleted inserted replaced
9080:afebde21cb32 9081:52cddd44ec11
780 ngx_quic_connection_t *qc; 780 ngx_quic_connection_t *qc;
781 781
782 qc = ngx_quic_get_connection(c); 782 qc = ngx_quic_get_connection(c);
783 783
784 /* RFC 9002, Appendix A.8. Setting the Loss Detection Timer */ 784 /* RFC 9002, Appendix A.8. Setting the Loss Detection Timer */
785
785 duration = qc->avg_rtt; 786 duration = qc->avg_rtt;
786
787 duration += ngx_max(4 * qc->rttvar, NGX_QUIC_TIME_GRANULARITY); 787 duration += ngx_max(4 * qc->rttvar, NGX_QUIC_TIME_GRANULARITY);
788 duration <<= qc->pto_count; 788 duration <<= qc->pto_count;
789
790 if (qc->congestion.in_flight == 0) { /* no in-flight packets */
791 return duration;
792 }
793 789
794 if (ctx->level == ssl_encryption_application && c->ssl->handshaked) { 790 if (ctx->level == ssl_encryption_application && c->ssl->handshaked) {
795 duration += qc->ctp.max_ack_delay << qc->pto_count; 791 duration += qc->ctp.max_ack_delay << qc->pto_count;
796 } 792 }
797 793