[nginx] QUIC: reset RTT estimator for the new path.

Sergey Kandaurov pluknet at nginx.com
Tue Dec 12 16:25:51 UTC 2023


details:   https://hg.nginx.org/nginx/rev/ff452f283aa9
branches:  
changeset: 9195:ff452f283aa9
user:      Sergey Kandaurov <pluknet at nginx.com>
date:      Tue Dec 12 20:20:51 2023 +0400
description:
QUIC: reset RTT estimator for the new path.

RTT is a property of the path, it must be reset on confirming a peer's
ownership of its new address.

diffstat:

 src/event/quic/ngx_event_quic.c            |  9 +--------
 src/event/quic/ngx_event_quic_connection.h |  7 +++++++
 src/event/quic/ngx_event_quic_migration.c  |  2 ++
 3 files changed, 10 insertions(+), 8 deletions(-)

diffs (48 lines):

diff -r a6f79f044de5 -r ff452f283aa9 src/event/quic/ngx_event_quic.c
--- a/src/event/quic/ngx_event_quic.c	Wed Nov 29 10:58:21 2023 +0400
+++ b/src/event/quic/ngx_event_quic.c	Tue Dec 12 20:20:51 2023 +0400
@@ -260,14 +260,7 @@ ngx_quic_new_connection(ngx_connection_t
 
     ngx_queue_init(&qc->free_frames);
 
-    qc->avg_rtt = NGX_QUIC_INITIAL_RTT;
-    qc->rttvar = NGX_QUIC_INITIAL_RTT / 2;
-    qc->min_rtt = NGX_TIMER_INFINITE;
-    qc->first_rtt = NGX_TIMER_INFINITE;
-
-    /*
-     * qc->latest_rtt = 0
-     */
+    ngx_quic_init_rtt(qc);
 
     qc->pto.log = c->log;
     qc->pto.data = c;
diff -r a6f79f044de5 -r ff452f283aa9 src/event/quic/ngx_event_quic_connection.h
--- a/src/event/quic/ngx_event_quic_connection.h	Wed Nov 29 10:58:21 2023 +0400
+++ b/src/event/quic/ngx_event_quic_connection.h	Tue Dec 12 20:20:51 2023 +0400
@@ -65,6 +65,13 @@ typedef struct ngx_quic_keys_s        ng
 
 #define ngx_quic_get_socket(c)               ((ngx_quic_socket_t *)((c)->udp))
 
+#define ngx_quic_init_rtt(qc)                                                 \
+    (qc)->avg_rtt = NGX_QUIC_INITIAL_RTT;                                     \
+    (qc)->rttvar = NGX_QUIC_INITIAL_RTT / 2;                                  \
+    (qc)->min_rtt = NGX_TIMER_INFINITE;                                       \
+    (qc)->first_rtt = NGX_TIMER_INFINITE;                                     \
+    (qc)->latest_rtt = 0;
+
 
 typedef enum {
     NGX_QUIC_PATH_IDLE = 0,
diff -r a6f79f044de5 -r ff452f283aa9 src/event/quic/ngx_event_quic_migration.c
--- a/src/event/quic/ngx_event_quic_migration.c	Wed Nov 29 10:58:21 2023 +0400
+++ b/src/event/quic/ngx_event_quic_migration.c	Tue Dec 12 20:20:51 2023 +0400
@@ -181,6 +181,8 @@ valid:
                                            14720));
         qc->congestion.ssthresh = (size_t) -1;
         qc->congestion.recovery_start = ngx_current_msec;
+
+        ngx_quic_init_rtt(qc);
     }
 
     path->validated = 1;


More information about the nginx-devel mailing list