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

Change the type of reset error #6

Closed
wants to merge 1 commit into from

Conversation

Wondertan
Copy link
Contributor

I've come to the moment where I had to check if the stream is reset while using go-yamux, but checking using the go-yamux internal error is not the case where there is a globally defined one.

Copy link
Member

@Stebalien Stebalien left a comment

Choose a reason for hiding this comment

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

Historically, yamux was a separate non-libp2p library that we forked. That's why the error is yamux specific. We didn't really want to make it depend on libp2p.

@whyrusleeping is there any more historical context here? If we make this library depend on go-libp2p, we might as well merge it into go-libp2p-yamux (the smux library wrapper).

@whyrusleeping
Copy link
Contributor

Hrm... I don't like this approach. This ends up meaning that to be conformant, your base level stream multiplexer needs to depend on libp2p, which isn't okay. Alternatively, we could define a go error trait, IsReset and type check for it at higher levels.

@Stebalien
Copy link
Member

Note: the other solution is to wrap the stream type in go-libp2p-yamux.

@Stebalien
Copy link
Member

Thoughts on this:

  1. Remove ErrReset from the core interfaces and replacing it with an interface definition.
  2. Instead of IsReset(), maybe use Abort() (or Reset()?) to match https://golang.org/pkg/net/#Error. Really, we're trying to distinguish between a random error and an explicit "go away" by one side.

@Stebalien
Copy link
Member

@raulk this brings up interface questions.

@Stebalien Stebalien requested a review from raulk August 5, 2019 18:18
@Wondertan
Copy link
Contributor Author

@whyrusleeping, agree with you about libp2p dependency, but then the issue is also applicable to go-mplex, which currently depends on go-libp2p-core/mux and returns mux.ErrReset on Read/Write when stream is in a reset state.

@Stebalien
Copy link
Member

It does, and that's my bad. I merged that PR without thinking about the dependency inversion (and we should probably revert it and do the same thing).

@Wondertan
Copy link
Contributor Author

Wondertan commented Aug 5, 2019

I think go-yamux should also have a libp2p stream wrapper, not only for session.

@Wondertan
Copy link
Contributor Author

@Stebalien why you migrated the repo to libp2p organization? Why not just simply depend on hashicorp's one?

@Stebalien
Copy link
Member

@Stebalien why you migrated the repo to libp2p organization? Why not just simply depend on hashicorp's one?

We needed to make some pretty invasive changes. Originally, we maintained a fork and mostly upstreamed patches but the implementations have diverged. We should try upstreaming changes but that'll be a significant task at this point.

@Wondertan
Copy link
Contributor Author

Closing in favor of libp2p/go-libp2p-yamux#10

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

Successfully merging this pull request may close these issues.

3 participants