Skip to content

Commit

Permalink
Minor tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
teor2345 committed Oct 21, 2021
1 parent 1d23b70 commit 6c19ab4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion zebra-network/src/peer_set/initialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// Portions of this submodule were adapted from tower-balance,
// which is (c) 2019 Tower Contributors (MIT licensed).

use rand::seq::SliceRandom;
use std::{collections::HashSet, net::SocketAddr, sync::Arc};

use futures::{
Expand All @@ -13,6 +12,7 @@ use futures::{
stream::{FuturesUnordered, StreamExt},
TryFutureExt,
};
use rand::seq::SliceRandom;
use tokio::{net::TcpListener, sync::broadcast, time::Instant};
use tower::{
buffer::Buffer, discover::Change, layer::Layer, load::peak_ewma::PeakEwmaDiscover,
Expand Down Expand Up @@ -302,6 +302,8 @@ async fn limit_initial_peers(config: &Config) -> HashSet<SocketAddr> {

let initial_peers_vect: Vec<SocketAddr> = initial_peers.iter().copied().collect();

// TODO: add unused peers to the AddressBook (#2931)
// https://docs.rs/rand/0.8.4/rand/seq/trait.SliceRandom.html#tymethod.partial_shuffle
initial_peers_vect
.choose_multiple(&mut rand::thread_rng(), config.peerset_initial_target_size)
.copied()
Expand Down

0 comments on commit 6c19ab4

Please sign in to comment.