From 10a14bf1b7a3241d183015c419232f65a3faace3 Mon Sep 17 00:00:00 2001 From: sukun Date: Tue, 16 Jul 2024 16:37:51 +0530 Subject: [PATCH 1/2] yamux: add error codes on stream reset --- yamux/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yamux/README.md b/yamux/README.md index f6a4b45fa..a522b5cf1 100644 --- a/yamux/README.md +++ b/yamux/README.md @@ -128,7 +128,7 @@ This does a half-close indicating the sender will send no further data. Once both sides have closed the connection, the stream is closed. -Alternatively, if an error occurs, the RST flag can be used to hard close a stream immediately. +Alternatively, if an error occurs, the RST flag can be used to hard close a stream immediately. To provide an error on stream resets, the first four bytes of the data following the header can contain a bigendian 32bit unsigned integer error code. Implementations should discard any data following the 4 bytes of error code. #### Flow Control From 2fc53ec16a1f95f550e016c71b9e7078ef1bff84 Mon Sep 17 00:00:00 2001 From: sukun Date: Wed, 28 Aug 2024 03:39:07 +0530 Subject: [PATCH 2/2] use window update frame for error codes --- yamux/README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/yamux/README.md b/yamux/README.md index a522b5cf1..14d4fe6f2 100644 --- a/yamux/README.md +++ b/yamux/README.md @@ -97,7 +97,11 @@ Both Ping and Go Away messages should always use the 0 StreamID. The meaning of the length field depends on the message type: * Data - provides the length of bytes following the header -* Window update - provides a delta update to the window size +* Window update: + * If RST flag is not set: + * Provides a delta update to the window size + * If RST flag is set: + * Contains an error code * Ping - Contains an opaque value, echoed back * Go Away - Contains an error code @@ -128,7 +132,7 @@ This does a half-close indicating the sender will send no further data. Once both sides have closed the connection, the stream is closed. -Alternatively, if an error occurs, the RST flag can be used to hard close a stream immediately. To provide an error on stream resets, the first four bytes of the data following the header can contain a bigendian 32bit unsigned integer error code. Implementations should discard any data following the 4 bytes of error code. +Alternatively, if an error occurs, the RST flag can be used to hard close a stream immediately. To provide an error code with the reset, use a window update frame with the RST flag set and set the Length field to the error code. #### Flow Control