Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yamux: add error codes on stream reset #622

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

sukunrt
Copy link
Member

@sukunrt sukunrt commented Jul 16, 2024

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 #622 (comment) for the alternative

@sukunrt
Copy link
Member Author

sukunrt commented Aug 28, 2024

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.

Copy link
Contributor

@MarcoPolo MarcoPolo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 👍

Let's wait to merge until we have a proper implementation though.

Also before merge:

  • @achingbrain to confirm this is backwards compatible with js-libp2p
  • @jxs / @MarcoPolo to confirm this is backwards compatible with rust-libp2p

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Triage
Development

Successfully merging this pull request may close these issues.

2 participants