From 23f47839fdc56fed7e778bf9645456d3641b6480 Mon Sep 17 00:00:00 2001 From: Tim Perry Date: Fri, 24 Jul 2026 12:20:16 +0200 Subject: [PATCH] quic: fix stop sending behaviour & callback Signed-off-by: Tim Perry --- 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 | 54 ----------------- .../test-quic-writer-stop-sending.mjs | 59 ------------------- typings/internalBinding/quic.d.ts | 1 + 15 files changed, 193 insertions(+), 168 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 1a592d85945ddb..e8314543ba15ad 100644 --- a/doc/api/quic.md +++ b/doc/api/quic.md @@ -2033,8 +2033,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. @@ -2045,6 +2044,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`