diff --git a/protocols/floodsub/src/layer.rs b/protocols/floodsub/src/layer.rs index 059ff505..4256e39b 100644 --- a/protocols/floodsub/src/layer.rs +++ b/protocols/floodsub/src/layer.rs @@ -29,8 +29,8 @@ use fnv::FnvHashSet; use libp2p_core::{connection::ConnectionId, PeerId}; use libp2p_core::{ConnectedPoint, Multiaddr}; use libp2p_swarm::{ - dial_opts::{self, DialOpts}, - NetworkBehaviour, NetworkBehaviourAction, NotifyHandler, OneShotHandler, PollParameters, + dial_opts::DialOpts, NetworkBehaviour, NetworkBehaviourAction, NotifyHandler, OneShotHandler, + PollParameters, }; use log::warn; use smallvec::SmallVec; @@ -109,9 +109,7 @@ impl Floodsub { if self.target_peers.insert(peer_id) { let handler = self.new_handler(); self.events.push_back(NetworkBehaviourAction::Dial { - opts: DialOpts::peer_id(peer_id) - .condition(dial_opts::PeerCondition::Disconnected) - .build(), + opts: DialOpts::peer_id(peer_id).build(), handler, }); } @@ -343,9 +341,7 @@ impl NetworkBehaviour for Floodsub { if self.target_peers.contains(id) { let handler = self.new_handler(); self.events.push_back(NetworkBehaviourAction::Dial { - opts: DialOpts::peer_id(*id) - .condition(dial_opts::PeerCondition::Disconnected) - .build(), + opts: DialOpts::peer_id(*id).build(), handler, }); } diff --git a/protocols/gossipsub/src/behaviour.rs b/protocols/gossipsub/src/behaviour.rs index 3ec0b117..82dc3469 100644 --- a/protocols/gossipsub/src/behaviour.rs +++ b/protocols/gossipsub/src/behaviour.rs @@ -41,8 +41,8 @@ use libp2p_core::{ multiaddr::Protocol::Ip6, ConnectedPoint, Multiaddr, PeerId, }; use libp2p_swarm::{ - dial_opts::{self, DialOpts}, - IntoConnectionHandler, NetworkBehaviour, NetworkBehaviourAction, NotifyHandler, PollParameters, + dial_opts::DialOpts, IntoConnectionHandler, NetworkBehaviour, NetworkBehaviourAction, + NotifyHandler, PollParameters, }; use wasm_timer::Instant; @@ -1143,9 +1143,7 @@ where debug!("Connecting to explicit peer {:?}", peer_id); let handler = self.new_handler(); self.events.push_back(NetworkBehaviourAction::Dial { - opts: DialOpts::peer_id(*peer_id) - .condition(dial_opts::PeerCondition::Disconnected) - .build(), + opts: DialOpts::peer_id(*peer_id).build(), handler, }); } @@ -1644,9 +1642,7 @@ where // dial peer let handler = self.new_handler(); self.events.push_back(NetworkBehaviourAction::Dial { - opts: DialOpts::peer_id(peer_id) - .condition(dial_opts::PeerCondition::Disconnected) - .build(), + opts: DialOpts::peer_id(peer_id).build(), handler, }); } diff --git a/protocols/identify/src/identify.rs b/protocols/identify/src/identify.rs index 9ed56b32..d30e98e1 100644 --- a/protocols/identify/src/identify.rs +++ b/protocols/identify/src/identify.rs @@ -26,9 +26,9 @@ use libp2p_core::{ Multiaddr, PeerId, PublicKey, }; use libp2p_swarm::{ - dial_opts::{self, DialOpts}, - AddressScore, ConnectionHandler, ConnectionHandlerUpgrErr, DialError, IntoConnectionHandler, - NegotiatedSubstream, NetworkBehaviour, NetworkBehaviourAction, NotifyHandler, PollParameters, + dial_opts::DialOpts, AddressScore, ConnectionHandler, ConnectionHandlerUpgrErr, DialError, + IntoConnectionHandler, NegotiatedSubstream, NetworkBehaviour, NetworkBehaviourAction, + NotifyHandler, PollParameters, }; use lru::LruCache; use std::{ @@ -196,9 +196,7 @@ impl Identify { if self.pending_push.insert(p) && !self.connected.contains_key(&p) { let handler = self.new_handler(); self.events.push_back(NetworkBehaviourAction::Dial { - opts: DialOpts::peer_id(p) - .condition(dial_opts::PeerCondition::Disconnected) - .build(), + opts: DialOpts::peer_id(p).build(), handler, }); } diff --git a/protocols/kad/src/behaviour.rs b/protocols/kad/src/behaviour.rs index 59d63b36..f40932ad 100644 --- a/protocols/kad/src/behaviour.rs +++ b/protocols/kad/src/behaviour.rs @@ -565,9 +565,7 @@ where kbucket::InsertResult::Pending { disconnected } => { let handler = self.new_handler(); self.queued_events.push_back(NetworkBehaviourAction::Dial { - opts: DialOpts::peer_id(disconnected.into_preimage()) - .condition(dial_opts::PeerCondition::Disconnected) - .build(), + opts: DialOpts::peer_id(disconnected.into_preimage()).build(), handler, }); RoutingUpdate::Pending @@ -1162,7 +1160,6 @@ where let handler = self.new_handler(); self.queued_events.push_back(NetworkBehaviourAction::Dial { opts: DialOpts::peer_id(disconnected.into_preimage()) - .condition(dial_opts::PeerCondition::Disconnected) .build(), handler, }) @@ -2342,9 +2339,7 @@ where query.inner.pending_rpcs.push((peer_id, event)); let handler = self.new_handler(); self.queued_events.push_back(NetworkBehaviourAction::Dial { - opts: DialOpts::peer_id(peer_id) - .condition(dial_opts::PeerCondition::Disconnected) - .build(), + opts: DialOpts::peer_id(peer_id).build(), handler, }); } diff --git a/protocols/request-response/src/lib.rs b/protocols/request-response/src/lib.rs index f8a4e2eb..ea334292 100644 --- a/protocols/request-response/src/lib.rs +++ b/protocols/request-response/src/lib.rs @@ -66,9 +66,8 @@ use futures::channel::oneshot; use handler::{RequestProtocol, RequestResponseHandler, RequestResponseHandlerEvent}; use libp2p_core::{connection::ConnectionId, ConnectedPoint, Multiaddr, PeerId}; use libp2p_swarm::{ - dial_opts::{self, DialOpts}, - DialError, IntoConnectionHandler, NetworkBehaviour, NetworkBehaviourAction, NotifyHandler, - PollParameters, + dial_opts::DialOpts, DialError, IntoConnectionHandler, NetworkBehaviour, + NetworkBehaviourAction, NotifyHandler, PollParameters, }; use smallvec::SmallVec; use std::{ @@ -385,9 +384,7 @@ where if let Some(request) = self.try_send_request(peer, request) { let handler = self.new_handler(); self.pending_events.push_back(NetworkBehaviourAction::Dial { - opts: DialOpts::peer_id(*peer) - .condition(dial_opts::PeerCondition::Disconnected) - .build(), + opts: DialOpts::peer_id(*peer).build(), handler, }); self.pending_outbound_requests