From 51dba42490ae49ca586437a641c5677e1f0e4c2a Mon Sep 17 00:00:00 2001 From: Roman Borschel Date: Mon, 1 Mar 2021 15:52:54 +0100 Subject: [PATCH] Re-enable 'parallel negotiation'. (#1934) Based on an estimate of the number of alternative protocols the dialer supports. --- misc/multistream-select/src/dialer_select.rs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/misc/multistream-select/src/dialer_select.rs b/misc/multistream-select/src/dialer_select.rs index 733c4903..cd2de652 100644 --- a/misc/multistream-select/src/dialer_select.rs +++ b/misc/multistream-select/src/dialer_select.rs @@ -56,17 +56,12 @@ 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