From 7a25eb74cc91672d286c4b5a3554c0d2b8e58c1c Mon Sep 17 00:00:00 2001 From: manNomi Date: Tue, 14 Jul 2026 01:59:30 +0900 Subject: [PATCH] quic: preserve session stats after close Signed-off-by: manNomi --- lib/internal/quic/stats.js | 2 +- test/parallel/test-quic-session-stream-lifecycle.mjs | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/internal/quic/stats.js b/lib/internal/quic/stats.js index cd986827c12c47..e7e8e7ee2719a4 100644 --- a/lib/internal/quic/stats.js +++ b/lib/internal/quic/stats.js @@ -870,7 +870,7 @@ class QuicSessionStats { [kFinishClose]() { const view = TypedArrayPrototypeSubarray(this.#handle, this.#offset, - this.#offset + IDX_STATS_STREAM_COUNT); + this.#offset + IDX_STATS_SESSION_COUNT); this.#handle = new BigUint64Array(view); this.#offset = 0; this.#disconnected = true; diff --git a/test/parallel/test-quic-session-stream-lifecycle.mjs b/test/parallel/test-quic-session-stream-lifecycle.mjs index a4bd287cdc6dcd..f88351597ee845 100644 --- a/test/parallel/test-quic-session-stream-lifecycle.mjs +++ b/test/parallel/test-quic-session-stream-lifecycle.mjs @@ -90,6 +90,8 @@ clientSession.destroy(); strictEqual(clientSession.destroyed, true); strictEqual(clientSession.endpoint, null); strictEqual(clientSession.stats.isConnected, false); +strictEqual(typeof clientSession.stats.cwnd, 'bigint'); +strictEqual(typeof clientSession.stats.streamsIdleTimedOut, 'bigint'); strictEqual(stream.destroyed, true);