Skip to content

Commit 2921232

Browse files
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 c59cd6b commit 2921232

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
@@ -1923,9 +1923,14 @@ True if `stream.destroy()` has been called.
19231923

19241924
### Aborting a stream
19251925

1926-
A QuicStream can be aborted in three ways, each producing different
1926+
A QuicStream can be aborted in several ways, each producing different
19271927
wire-frame side effects:
19281928

1929+
* [`stream.stopSending()`][] — Aborts only the readable side. Sends
1930+
`STOP_SENDING` to the peer. The writable side is unaffected.
1931+
* [`stream.resetStream()`][] — Aborts only the writable side. Sends
1932+
`RESET_STREAM` to the peer. Unlike [`writer.fail(reason)`][], the wire
1933+
code is given directly rather than derived from an error.
19291934
* [`writer.fail(reason)`][] — Aborts only the writable side. Sends
19301935
`RESET_STREAM` to the peer. The readable side is unaffected; any data
19311936
already buffered for read remains available.
@@ -1943,6 +1948,46 @@ the wire code for both `writer.fail()` and `stream.destroy()`. Otherwise
19431948
the implementation falls back to the negotiated application protocol's
19441949
"internal error" code (see [`QuicError`][]).
19451950

1951+
[`stream.stopSending()`][] and [`stream.resetStream()`][] do
1952+
not perform this derivation: they send `code` as given.
1953+
1954+
### `stream.resetStream([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+
Tells the peer that this end will not send any more data on this stream,
1964+
sending a `RESET_STREAM` frame carrying `code`. The readable side is left
1965+
open, so data already sent by the peer remains available to read.
1966+
1967+
Any data still queued for sending is discarded. A reset stream is never
1968+
acknowledged by the peer, so the outbound queue can no longer drain.
1969+
1970+
No acknowledgement of this action is provided. The call does nothing if the
1971+
stream has been destroyed, if it has already been reset, or if it is a
1972+
remote-initiated unidirectional stream, which has no writable side to abort.
1973+
1974+
### `stream.stopSending([code])`
1975+
1976+
<!-- YAML
1977+
added: v23.8.0
1978+
-->
1979+
1980+
* `code` {number|bigint} The application error code to send to the peer.
1981+
**Default:** `0n`.
1982+
1983+
Asks the peer to stop sending data on this stream, sending a `STOP_SENDING`
1984+
frame carrying `code`. The writable side is left open, so this end can
1985+
still send data.
1986+
1987+
No acknowledgement of this action is provided. The call does nothing if the
1988+
stream has been destroyed, or if it is a locally-initiated unidirectional
1989+
stream, which has no readable side to abort.
1990+
19461991
### `stream.early`
19471992

19481993
<!-- YAML
@@ -4586,11 +4631,13 @@ throughput issues caused by flow control.
45864631
[`stream.onwanttrailers`]: #streamonwanttrailers
45874632
[`stream.pendingTrailers`]: #streampendingtrailers
45884633
[`stream.priority`]: #streampriority
4634+
[`stream.resetStream()`]: #streamresetstreamcode
45894635
[`stream.sendHeaders()`]: #streamsendheadersheaders-options
45904636
[`stream.sendInformationalHeaders()`]: #streamsendinformationalheadersheaders
45914637
[`stream.sendTrailers()`]: #streamsendtrailersheaders
45924638
[`stream.setBody()`]: #streamsetbodybody
45934639
[`stream.setPriority()`]: #streamsetpriorityoptions
4640+
[`stream.stopSending()`]: #streamstopsendingcode
45944641
[`stream.writer`]: #streamwriter
45954642
[`writer.fail()`]: #streamwriter
45964643
[`writer.fail(reason)`]: #streamwriter

0 commit comments

Comments
 (0)