]> git.kaiwu.me - nginx.git/commitdiff
QUIC: removed check for in-flight packets in computing PTO.
authorSergey Kandaurov <pluknet@nginx.com>
Tue, 9 May 2023 15:42:38 +0000 (19:42 +0400)
committerSergey Kandaurov <pluknet@nginx.com>
Tue, 9 May 2023 15:42:38 +0000 (19:42 +0400)
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.

src/event/quic/ngx_event_quic_ack.c

index d236deb59c2815f749dfc0a836a936735a42a888..2458c9aea1141ec7922e9c8d4ab83a1ef35aebdc 100644 (file)
@@ -782,15 +782,11 @@ ngx_quic_pto(ngx_connection_t *c, ngx_quic_send_ctx_t *ctx)
     qc = ngx_quic_get_connection(c);
 
     /* RFC 9002, Appendix A.8.  Setting the Loss Detection Timer */
-    duration = qc->avg_rtt;
 
+    duration = qc->avg_rtt;
     duration += ngx_max(4 * qc->rttvar, NGX_QUIC_TIME_GRANULARITY);
     duration <<= qc->pto_count;
 
-    if (qc->congestion.in_flight == 0) { /* no in-flight packets */
-        return duration;
-    }
-
     if (ctx->level == ssl_encryption_application && c->ssl->handshaked) {
         duration += qc->ctp.max_ack_delay << qc->pto_count;
     }