Skip to content

Commit

Permalink
[multistream-select] Temporarily disable "parallel" negotiation. (#1807)
Browse files Browse the repository at this point in the history
* [multistream-select] Temp. disable "parallel" negotiation.

In order to later change the "ls" responses for spec-compliance.

* Update version.

* Update misc/multistream-select/CHANGELOG.md

Co-authored-by: Max Inden <mail@max-inden.de>

Co-authored-by: Max Inden <mail@max-inden.de>
  • Loading branch information
romanb and mxinden authored Oct 20, 2020
1 parent a3d6c81 commit e5adb67
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
6 changes: 6 additions & 0 deletions misc/multistream-select/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 0.8.4 [2020-10-20]

- Temporarily disable the internal selection of "parallel" protocol
negotiation for the dialer to later change the response format of the "ls"
message for spec compliance. See https://github.com/libp2p/rust-libp2p/issues/1795.

# 0.8.3 [2020-10-16]

- Fix a regression resulting in a panic with the `V1Lazy` protocol.
Expand Down
2 changes: 1 addition & 1 deletion misc/multistream-select/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "multistream-select"
description = "Multistream-select negotiation protocol for libp2p"
version = "0.8.3"
version = "0.8.4"
authors = ["Parity Technologies <admin@parity.io>"]
license = "MIT"
repository = "https://github.com/libp2p/rust-libp2p"
Expand Down
19 changes: 12 additions & 7 deletions misc/multistream-select/src/dialer_select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,17 @@ where
I::Item: AsRef<[u8]>
{
let iter = protocols.into_iter();
// NOTE: Temporarily disabled "parallel" negotiation in order to correct the
// "ls" responses towards interoperability and (new) spec compliance.
// See https://github.com/libp2p/rust-libp2p/issues/1795.
Either::Left(dialer_select_proto_serial(inner, iter, version))

// We choose between the "serial" and "parallel" strategies based on the number of protocols.
if iter.size_hint().1.map(|n| n <= 3).unwrap_or(false) {
Either::Left(dialer_select_proto_serial(inner, iter, version))
} else {
Either::Right(dialer_select_proto_parallel(inner, iter, version))
}
// if iter.size_hint().1.map(|n| n <= 3).unwrap_or(false) {
// Either::Left(dialer_select_proto_serial(inner, iter, version))
// } else {
// Either::Right(dialer_select_proto_parallel(inner, iter, version))
// }
}

/// Future, returned by `dialer_select_proto`, which selects a protocol and dialer
Expand All @@ -76,7 +81,7 @@ pub type DialerSelectFuture<R, I> = Either<DialerSelectSeq<R, I>, DialerSelectPa
/// trying the given list of supported protocols one-by-one.
///
/// This strategy is preferable if the dialer only supports a few protocols.
pub fn dialer_select_proto_serial<R, I>(
pub(crate) fn dialer_select_proto_serial<R, I>(
inner: R,
protocols: I,
version: Version
Expand Down Expand Up @@ -105,7 +110,7 @@ where
///
/// This strategy may be beneficial if the dialer supports many protocols
/// and it is unclear whether the remote supports one of the first few.
pub fn dialer_select_proto_parallel<R, I>(
pub(crate) fn dialer_select_proto_parallel<R, I>(
inner: R,
protocols: I,
version: Version
Expand Down

0 comments on commit e5adb67

Please sign in to comment.