From 8a00872183fc104d99ed1e39fd3b32aece018cf4 Mon Sep 17 00:00:00 2001 From: Tim Perry <1526883+pimterry@users.noreply.github.com> Date: Tue, 4 Aug 2026 11:07:31 +0200 Subject: [PATCH] quic: fix stop sending behaviour & callback Signed-off-by: Tim Perry PR-URL: https://github.com/nodejs/node/pull/64710 Reviewed-By: James M Snell --- doc/api/quic.md | 29 +++++++--- lib/internal/quic/quic.js | 50 ++++++++++++++++ lib/internal/quic/state.js | 24 ++++++++ lib/internal/quic/symbols.js | 2 + src/quic/bindingdata.h | 1 + src/quic/session.cc | 22 +++---- src/quic/streams.cc | 27 +++++---- src/quic/streams.h | 3 + ...est-quic-internal-endpoint-stats-state.mjs | 1 + .../test-quic-internal-setcallbacks.mjs | 1 + ...quic-stream-destroy-emits-stop-sending.mjs | 29 ++-------- ...test-quic-stream-stop-sending-callback.mjs | 58 +++++++++++++++++++ .../test-quic-stream-stop-sending.mjs | 52 ----------------- .../test-quic-writer-stop-sending.mjs | 57 ------------------ typings/internalBinding/quic.d.ts | 1 + 15 files changed, 193 insertions(+), 164 deletions(-) create mode 100644 test/parallel/test-quic-stream-stop-sending-callback.mjs delete mode 100644 test/parallel/test-quic-stream-stop-sending.mjs delete mode 100644 test/parallel/test-quic-writer-stop-sending.mjs diff --git a/doc/api/quic.md b/doc/api/quic.md index ce9a8c94514..3f18dc528e8 100644 --- a/doc/api/quic.md +++ b/doc/api/quic.md @@ -2013,8 +2013,7 @@ added: v23.8.0 The callback to invoke when the peer aborts a direction of the stream by sending a `RESET_STREAM` frame (the peer abandons their writable side, so -no further data will arrive on our readable side) or a `STOP_SENDING` -frame (the peer asks us to stop writing on our writable side). +no further data will arrive on our readable side). The callback receives a Node.js error whose `errorCode` (`bigint`) property carries the application error code from the wire frame. @@ -2025,6 +2024,21 @@ continue using the still-active direction on a bidirectional stream), abort the other direction with [`writer.fail()`][], or tear down the whole stream with [`stream.destroy()`][]. Read/write. +### `stream.onstopsending` + + + +* Type: {quic.OnStreamErrorCallback} + +The callback to invoke when the peer aborts a direction of the stream by +sending a `STOP_SENDING` frame (the peer asks us to stop writing on our +writable side). + +The callback receives a Node.js error whose `errorCode` (`bigint`) +property carries the application error code from the wire frame. Read/write. + ### `stream.headers`