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

[multistream-select] Fix panic with V1Lazy (regression) and more convenient transport boxing. #1783

Merged
merged 4 commits into from
Oct 7, 2020

Conversation

romanb
Copy link
Contributor

@romanb romanb commented Oct 5, 2020

Fixes a panic when using the V1Lazy negotiation protocol, a regression introduced in 1484(Upgrade to stable futures). Thereby adds integration tests for a transport upgrade with both V1 and V1Lazy to the multistream-select crate to prevent future regressions.

As a small refactoring on the side, I changed Transport::boxed to always also box the StreamMuxer and the transport errors, as this is how boxed transport are pretty much always used. I don't think it is necessary to support boxing of a transport at various levels of granularity. Now, when you want a boxed transport you just need to tack on .boxed() at the end of the transport builder and get a boxed transport with a boxed stream muxer and boxed transport errors, i.e. a simple boxed type for the whole transport.

Roman S. Borschel added 3 commits October 5, 2020 11:01
Fixes a panic when using the `V1Lazy` negotiation protocol,
a regression introduced in libp2p#1484.

Thereby adds integration tests for a transport upgrade with both
`V1` and `V1Lazy` to the `multistream-select` crate to prevent
future regressions.
@@ -127,6 +127,7 @@ impl<TInner> Negotiated<TInner> {

if let Message::Header(v) = &msg {
if *v == version {
*this.state = State::Expecting { io, protocol, version };
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the patch for the regression, where this line got removed.

Copy link
Member

@tomaka tomaka left a comment

Choose a reason for hiding this comment

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

Looks good to me

@romanb romanb merged commit 3e31ea9 into libp2p:master Oct 7, 2020
@romanb romanb deleted the multiselect-fix-v1lazy branch October 7, 2020 09: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.

2 participants