From 8a598fd0231476c1daba6e5bc15bb9bf72dec12e Mon Sep 17 00:00:00 2001 From: James M Snell Date: Fri, 15 May 2026 22:55:06 -0700 Subject: [PATCH] quic: add initial RTT option to session options Signed-off-by: James M Snell Assisted-by: OpenCode:Opus 4.6 PR-URL: https://github.com/nodejs/node/pull/63267 Reviewed-By: Matteo Collina --- doc/api/quic.md | 17 ++++++ lib/internal/quic/quic.js | 5 ++ src/quic/bindingdata.h | 1 + src/quic/session.cc | 21 +++++-- src/quic/session.h | 9 +++ .../test-quic-session-initial-rtt.mjs | 60 +++++++++++++++++++ 6 files changed, 109 insertions(+), 4 deletions(-) create mode 100644 test/parallel/test-quic-session-initial-rtt.mjs diff --git a/doc/api/quic.md b/doc/api/quic.md index 259fe89916b..65c0591b22e 100644 --- a/doc/api/quic.md +++ b/doc/api/quic.md @@ -2747,6 +2747,23 @@ added: v23.8.0 Specifies the maximum number of milliseconds a TLS handshake is permitted to take to complete before timing out. +#### `sessionOptions.initialRtt` + + + +* Type: {bigint|number} +* **Default:** `0` (use ngtcp2 default of 333ms) + +Specifies the initial round-trip time estimate in milliseconds. This value is +used for probe timeout (PTO) computation, initial pacing, and early loss +detection before the first actual RTT sample is collected from the connection. +The default of 333ms is appropriate for the general internet. For low-latency +environments such as loopback or same-rack deployments, setting a value closer +to the actual RTT (e.g., `1`) avoids unnecessarily conservative initial +behavior. + #### `sessionOptions.keepAlive`