Open sukunrt opened 4 months ago
We cannot send an error code in Data frames because the body of Data frames is subject to flow control. Using the body of the Data frame will require us to wait for resetting a stream when the receive window on the peer is full.
We can use the Window Update frame to send the error code in the Length field similar to how a GoAway frame does. This has no issues as it's not subject to flow control. The Length field has no meaning for existing implementations as the stream is Reset on receiving a frame with RST flag set.
Required for #479
As I understand, all the implementations discard the data when receiving a frame with the
RST
flag set. @MarcoPolo @achingbrain can you confirm this for rust-yamux and js-yamux. I think this is what both the implementations are doing.~We send the error code as a 4byte integer following the header. We cannot use the length field like in a goaway frame, because all the implementations look at the length field and read length bytes of data even with the RST flag set.~ See https://github.com/libp2p/specs/pull/622#issuecomment-2314399167 for the alternative