Skip to content

Commit

Permalink
Stop using CallAllUnordered in peer_set::add_initial_peers (#1705)
Browse files Browse the repository at this point in the history
* use ServiceExt::oneshot and FuturesUnordered

Co-authored-by: teor <teor@riseup.net>
  • Loading branch information
oxarbitrage and teor2345 authored Feb 8, 2021
1 parent 0723ac5 commit 241c7ad
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions zebra-network/src/peer_set/initialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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?;
Expand Down

0 comments on commit 241c7ad

Please sign in to comment.