@@ -1232,19 +1232,19 @@ abruptly terminate transmission on a stream. The frame is as follows:
12321232 0 1 2 3
12331233 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
12341234+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1235- | Stream ID (32) |
1236- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
12371235| Error Code (32) |
12381236+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1237+ | Stream ID (32) |
1238+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
12391239~~~
12401240
12411241The fields are :
12421242
1243- * Stream ID: The 32-bit Stream ID of the stream being terminated.
1244-
12451243* Error code: A 32-bit error code which indicates why the stream should be
12461244 closed.
12471245
1246+ * Stream ID: The 32-bit Stream ID of the stream being terminated.
1247+
12481248
12491249# # PADDING Frame {#frame-padding}
12501250
@@ -1518,16 +1518,10 @@ or a RST_STREAM frame. These indicate the clean or abrupt termination of data
15181518flow on the stream, respectively. In either case, this causes the stream to
15191519transition into one of the "half-closed" states. An endpoint sending an FIN
15201520flag or a RST_STREAM frame causes the stream state to become "half-closed
1521- (local)". An endpoint receiving a FIN flag or a RST_STREAM frame causes the
1522- stream state to become "half-closed (remote)". The receiving endpoint MUST NOT
1523- process the FIN flag until all preceding data on the stream has been received,
1524- but MAY process a RST_STREAM frame immediately and discard any preceding data.
1525-
1526- Either endpoint can send a REQUEST_RST frame in this state to request closure of
1527- the stream in the opposite direction. This typically indicates that the
1528- receiving application is no longer reading from the stream and all future data
1529- will be discarded upon receipt. An endpoint SHOULD respond to a REQUEST_RST
1530- with a RST_STREAM of type QUIC_RECEIVED_RST.
1521+ (local)". An endpoint receiving a FIN flag causes the stream state to become
1522+ " half-closed (remote)" once all preceding data on the stream has been received.
1523+ An endpoint receiving a RST_STREAM frame causes the stream state to become
1524+ " half-closed (remote)" immediately; any preceding data MAY be discarded.
15311525
15321526# ## half-closed (local)
15331527
@@ -1544,17 +1538,6 @@ flow-controlled frames. In this state, a receiver MAY ignore WINDOW_UPDATE
15441538frames for this stream, which might arrive for a short period after a frame
15451539bearing the FIN flag is sent.
15461540
1547- If an endpoint is no longer interested in the data being received in this state,
1548- it MAY send a REQUEST_RST frame to request that the peer close the stream.
1549- STREAM frames received after sending REQUEST_RST are still counted toward the
1550- connection and stream flow-control windows. Even though these frames might be
1551- ignored, because they are sent before their sender receives the REQUEST_RST, the
1552- sender will consider the frames to count against its flow-control windows.
1553-
1554- If a REQUEST_RST frame is received on a stream that is already in the
1555- " half-closed (local)" state, a RST_STREAM frame SHOULD still be sent,
1556- so that no STREAM frames previously sent will be retransmitted.
1557-
15581541# ## half-closed (remote)
15591542
15601543A stream that is "half-closed (remote)" is no longer being used by the peer to
@@ -1573,8 +1556,7 @@ In this state, the endpoint continues to observe advertised stream-level and
15731556connection-level flow-control limits ({{flow-control}}).
15741557
15751558A stream can transition from this state to "closed" by sending a STREAM frame
1576- that contains a FIN flag or by sending a RST_STREAM frame. Upon receipt of a
1577- REQUEST_RST frame, a RST_STREAM frame SHOULD be sent in response.
1559+ that contains a FIN flag or by sending a RST_STREAM frame.
15781560
15791561# ## closed
15801562
@@ -1595,7 +1577,26 @@ implementations SHOULD treat the receipt of a frame that is not expressly
15951577permitted in the description of a state as a connection error
15961578({{error-handling}}). Frames of unknown types are ignored.
15971579
1598- (TODO : QUIC_STREAM_NO_ERROR is a special case. Write it up.)
1580+
1581+ # # Solicited State Transitions
1582+
1583+ If an endpoint is no longer interested in the data being received, it MAY send a
1584+ REQUEST_RST frame on a stream in the "open" or "half-closed (local)" state to
1585+ request closure of the stream in the opposite direction. This typically
1586+ indicates that the receiving application is no longer reading from the stream
1587+ and all future data will be discarded upon receipt.
1588+
1589+ STREAM frames received after sending REQUEST_RST are still counted toward the
1590+ connection and stream flow-control windows. Even though these frames will be
1591+ discarded, because they are sent before their sender receives the REQUEST_RST,
1592+ the sender will consider the frames to count against its flow-control windows.
1593+
1594+ Upon receipt of a REQUEST_RST frame, an endpoint SHOULD send a RST_STREAM with
1595+ an error code of QUIC_RECEIVED_RST. If the REQUEST_RST frame is received on a
1596+ stream that is already in the "half-closed (local)" or "closed" states, a
1597+ RST_STREAM frame SHOULD still be sent and retransmitted of previously-sent
1598+ STREAM frames SHOULD be cancelled.
1599+
15991600
16001601# # Stream Identifiers {#stream-identifiers}
16011602
@@ -1720,14 +1721,13 @@ waiting for a WINDOW_UPDATE which will never come.
17201721
17211722# ## Mid-stream RST_STREAM
17221723
1723- On receipt of an RST_STREAM frame, an endpoint will tear down state for the
1724- ignore further data arriving on that stream. This could result in the endpoints
1725- getting out of sync, since the RST_STREAM frame may have arrived out of order
1726- and there may be further bytes in flight. The data sender would have counted
1727- the data against its connection level flow control budget, but a receiver that
1728- has not received these bytes would not know to include them as well. The
1729- receiver must learn of the number of bytes that were sent on the stream to make
1730- the same adjustment in its connection flow controller.
1724+ On receipt of a RST_STREAM frame, an endpoint will ignore further data arriving
1725+ on that stream. Since the RST_STREAM frame may have arrived out of order, there
1726+ may be further bytes in flight. The data sender would have counted the data
1727+ against its connection level flow control budget, but a receiver that has not
1728+ received these bytes would not know to include them as well. The receiver must
1729+ learn of the number of bytes that were sent on the stream to make the same
1730+ adjustment in its connection flow controller.
17311731
17321732To avoid this de-synchronization, a RST_STREAM sender MUST include the final
17331733byte offset sent on the stream in the RST_STREAM frame. On receiving a
@@ -1738,13 +1738,17 @@ controller.
17381738
17391739# ## Response to a RST_STREAM
17401740
1741- Since streams are bidirectional, a sender of a RST_STREAM needs to know how many
1742- bytes the peer has sent on the stream. An endpoint that receives a RST_STREAM
1743- frame (and which has not sent a FIN or a RST_STREAM) MUST immediately respond
1744- with a RST_STREAM frame bearing the offset of the last byte sent on this stream
1745- as the final offset, and MUST NOT send any more data on the stream. This
1746- RST_STREAM SHOULD contain the error code QUIC_RECEIVED_RST.
1747-
1741+ RST_STREAM terminates a stream abruptly. Whether any action or response can
1742+ or should be taken on the data already received is an application-specific
1743+ issue. If the sender of a RST_STREAM wishes to explicitly state that no future
1744+ data will be processed, that endpoint MAY send a REQUEST_RST frame at the same
1745+ time.
1746+
1747+ Regardless, it will often be the case that upon receipt of a RST_STREAM, an
1748+ endpoint will choose to stop sending data in its own direction. An endpoint that
1749+ receives a RST_STREAM frame MUST still close the stream for sending in the other
1750+ direction, either with a STREAM frame containing the FIN bit or a RST_STREAM
1751+ frame of its own, but MAY choose not to do so immediately.
17481752
17491753# ## Offset Increment
17501754
0 commit comments