-
Notifications
You must be signed in to change notification settings - Fork 957
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
muxers/mplex: Implement AsyncRead
and AsyncWrite
for Substream
#2706
Conversation
This aligns the public API of the `libp2p-mplex` module with the one from `libp2p-yamux`. This change has two benefits: 1. For standalone users of `libp2p-mplex`, the substreams itself are now useful, similar to `libp2p-yamux` and don't necessarily need to be polled via the `StreamMuxer`. The `StreamMuxer` only forwards to the `Async{Read,Write}` implementations. 2. This will reduce the diff of #2648 because we can chunk the one giant commit into smaller atomic ones.
I've benchmarked this branch separately and cannot reliably find any regressions. The benchmarks do sometimes report changes in the 5% range but those are not stable so I think this change is harmless for performance. |
Agreed. I like that this is making it more consistent with Thanks isolating this change! |
@@ -3,7 +3,7 @@ name = "libp2p-mplex" | |||
edition = "2021" | |||
rust-version = "1.56.1" | |||
description = "Mplex multiplexing protocol for libp2p" | |||
version = "0.33.0" | |||
version = "0.34.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
version = "0.34.0" | |
version = "0.33.1" |
Is this a breaking change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes because Substream
is a public type and has type parameter now!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, good point. Thanks!
Co-authored-by: Max Inden <mail@max-inden.de>
v0.46.0 is not yet released, thus no need to bump to v0.47.0.
Description
This aligns the public API of the
libp2p-mplex
module with the onefrom
libp2p-yamux
. This change has two benefits:For standalone users of
libp2p-mplex
, the substreams itself arenow useful, similar to
libp2p-yamux
and don't necessarily need tobe polled via the
StreamMuxer
. TheStreamMuxer
only forwards tothe
Async{Read,Write}
implementations.This will reduce the diff of core/muxing: Redesign
StreamMuxer
trait #2648 because we can chunk the onegiant commit into smaller atomic ones.
Whilst keeping master functional, the state of
StreamMuxer
is nowa bit awkward until we merge #2648. However, given we are already
doing things this way for
libp2p-yamux
it shouldn't be an issue?Links to any relevant issues
Will reduce diff in #2648.
Open Questions
Change checklist
I have added tests that prove my fix is effective or that my feature works