Skip to content

Commit 39ea929

Browse files
theSnackOverflowaduh95
authored andcommitted
doc: document quic stopSending() and resetStream()
`QuicStream` exposes `stopSending()` and `resetStream()`, but neither appeared in the QuicStream API reference. Both matter when half-closing a stream, which protocols such as WebTransport rely on. Document the two methods and list them in the "Aborting a stream" summary, which previously covered only `writer.fail()` and `stream.destroy()`. Unlike those, both send the given code as-is rather than deriving a wire code from an error. Fixes: #63680 Signed-off-by: Ji Hoon Kang <ivory.ma9ic@gmail.com> PR-URL: #64888 Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent dcf65c5 commit 39ea929

1 file changed

Lines changed: 48 additions & 1 deletion

File tree

doc/api/quic.md

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1903,9 +1903,14 @@ True if `stream.destroy()` has been called.
19031903

19041904
### Aborting a stream
19051905

1906-
A QuicStream can be aborted in three ways, each producing different
1906+
A QuicStream can be aborted in several ways, each producing different
19071907
wire-frame side effects:
19081908

1909+
* [`stream.stopSending()`][] — Aborts only the readable side. Sends
1910+
`STOP_SENDING` to the peer. The writable side is unaffected.
1911+
* [`stream.resetStream()`][] — Aborts only the writable side. Sends
1912+
`RESET_STREAM` to the peer. Unlike [`writer.fail(reason)`][], the wire
1913+
code is given directly rather than derived from an error.
19091914
* [`writer.fail(reason)`][] — Aborts only the writable side. Sends
19101915
`RESET_STREAM` to the peer. The readable side is unaffected; any data
19111916
already buffered for read remains available.
@@ -1923,6 +1928,46 @@ the wire code for both `writer.fail()` and `stream.destroy()`. Otherwise
19231928
the implementation falls back to the negotiated application protocol's
19241929
"internal error" code (see [`QuicError`][]).
19251930

1931+
[`stream.stopSending()`][] and [`stream.resetStream()`][] do
1932+
not perform this derivation: they send `code` as given.
1933+
1934+
### `stream.resetStream([code])`
1935+
1936+
<!-- YAML
1937+
added: v23.8.0
1938+
-->
1939+
1940+
* `code` {number|bigint} The application error code to send to the peer.
1941+
**Default:** `0n`.
1942+
1943+
Tells the peer that this end will not send any more data on this stream,
1944+
sending a `RESET_STREAM` frame carrying `code`. The readable side is left
1945+
open, so data already sent by the peer remains available to read.
1946+
1947+
Any data still queued for sending is discarded. A reset stream is never
1948+
acknowledged by the peer, so the outbound queue can no longer drain.
1949+
1950+
No acknowledgement of this action is provided. The call does nothing if the
1951+
stream has been destroyed, if it has already been reset, or if it is a
1952+
remote-initiated unidirectional stream, which has no writable side to abort.
1953+
1954+
### `stream.stopSending([code])`
1955+
1956+
<!-- YAML
1957+
added: v23.8.0
1958+
-->
1959+
1960+
* `code` {number|bigint} The application error code to send to the peer.
1961+
**Default:** `0n`.
1962+
1963+
Asks the peer to stop sending data on this stream, sending a `STOP_SENDING`
1964+
frame carrying `code`. The writable side is left open, so this end can
1965+
still send data.
1966+
1967+
No acknowledgement of this action is provided. The call does nothing if the
1968+
stream has been destroyed, or if it is a locally-initiated unidirectional
1969+
stream, which has no readable side to abort.
1970+
19261971
### `stream.early`
19271972

19281973
<!-- YAML
@@ -4556,11 +4601,13 @@ throughput issues caused by flow control.
45564601
[`stream.onwanttrailers`]: #streamonwanttrailers
45574602
[`stream.pendingTrailers`]: #streampendingtrailers
45584603
[`stream.priority`]: #streampriority
4604+
[`stream.resetStream()`]: #streamresetstreamcode
45594605
[`stream.sendHeaders()`]: #streamsendheadersheaders-options
45604606
[`stream.sendInformationalHeaders()`]: #streamsendinformationalheadersheaders
45614607
[`stream.sendTrailers()`]: #streamsendtrailersheaders
45624608
[`stream.setBody()`]: #streamsetbodybody
45634609
[`stream.setPriority()`]: #streamsetpriorityoptions
4610+
[`stream.stopSending()`]: #streamstopsendingcode
45644611
[`stream.writer`]: #streamwriter
45654612
[`writer.fail()`]: #streamwriter
45664613
[`writer.fail(reason)`]: #streamwriter

0 commit comments

Comments
 (0)