Stop using CallAllUnordered in peer_set::add_initial_peers (#1705)

* use ServiceExt::oneshot and FuturesUnordered

Co-authored-by: teor <teor@riseup.net>
This commit is contained in:
Alfredo Garcia 2021-02-08 19:16:02 -03:00 committed by GitHub
parent 0723ac5be1
commit 241c7ad849
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -194,9 +194,10 @@ where
S::Future: Send + 'static,
{
info!(?initial_peers, "Connecting to initial peer set");
use tower::util::CallAllUnordered;
let addr_stream = futures::stream::iter(initial_peers.into_iter());
let mut handshakes = CallAllUnordered::new(connector, addr_stream);
let mut handshakes = initial_peers
.iter()
.map(|request| connector.clone().oneshot(*request))
.collect::<futures::stream::FuturesUnordered<_>>();
while let Some(handshake_result) = handshakes.next().await {
tx.send(handshake_result).await?;