mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-05-27 17:51:20 +00:00
relay: Use SliceRandom::shuffle
. (#722)
Fixes deprecation warning related to `Rng::shuffle` which recommends `SliceRandom::shuffle` instead.
This commit is contained in:
parent
acfa1c9c79
commit
730558985f
@ -29,7 +29,7 @@ use libp2p_core::{transport::Transport, upgrade::apply_outbound};
|
||||
use log::{debug, info, trace};
|
||||
use multiaddr::Multiaddr;
|
||||
use peerstore::{PeerAccess, PeerId, Peerstore};
|
||||
use rand::{self, Rng};
|
||||
use rand::prelude::*;
|
||||
use std::{io, iter::FromIterator, ops::Deref, sync::Arc};
|
||||
use tokio_io::{AsyncRead, AsyncWrite};
|
||||
|
||||
@ -130,7 +130,7 @@ where
|
||||
}
|
||||
|
||||
// Try one relay after another and stick to the first working one.
|
||||
rand::thread_rng().shuffle(&mut dials); // randomise to spread load
|
||||
dials.shuffle(&mut thread_rng()); // randomise to spread load
|
||||
let dest_peer = destination.id.clone();
|
||||
let future = stream::iter_ok(dials.into_iter())
|
||||
.and_then(|dial| dial)
|
||||
|
Loading…
x
Reference in New Issue
Block a user