mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-14 10:31:21 +00:00
protocols/: Remove passing default variant to WithPeerId::condition
(#2802)
This commit is contained in:
@ -29,8 +29,8 @@ use fnv::FnvHashSet;
|
|||||||
use libp2p_core::{connection::ConnectionId, PeerId};
|
use libp2p_core::{connection::ConnectionId, PeerId};
|
||||||
use libp2p_core::{ConnectedPoint, Multiaddr};
|
use libp2p_core::{ConnectedPoint, Multiaddr};
|
||||||
use libp2p_swarm::{
|
use libp2p_swarm::{
|
||||||
dial_opts::{self, DialOpts},
|
dial_opts::DialOpts, NetworkBehaviour, NetworkBehaviourAction, NotifyHandler, OneShotHandler,
|
||||||
NetworkBehaviour, NetworkBehaviourAction, NotifyHandler, OneShotHandler, PollParameters,
|
PollParameters,
|
||||||
};
|
};
|
||||||
use log::warn;
|
use log::warn;
|
||||||
use smallvec::SmallVec;
|
use smallvec::SmallVec;
|
||||||
@ -109,9 +109,7 @@ impl Floodsub {
|
|||||||
if self.target_peers.insert(peer_id) {
|
if self.target_peers.insert(peer_id) {
|
||||||
let handler = self.new_handler();
|
let handler = self.new_handler();
|
||||||
self.events.push_back(NetworkBehaviourAction::Dial {
|
self.events.push_back(NetworkBehaviourAction::Dial {
|
||||||
opts: DialOpts::peer_id(peer_id)
|
opts: DialOpts::peer_id(peer_id).build(),
|
||||||
.condition(dial_opts::PeerCondition::Disconnected)
|
|
||||||
.build(),
|
|
||||||
handler,
|
handler,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -343,9 +341,7 @@ impl NetworkBehaviour for Floodsub {
|
|||||||
if self.target_peers.contains(id) {
|
if self.target_peers.contains(id) {
|
||||||
let handler = self.new_handler();
|
let handler = self.new_handler();
|
||||||
self.events.push_back(NetworkBehaviourAction::Dial {
|
self.events.push_back(NetworkBehaviourAction::Dial {
|
||||||
opts: DialOpts::peer_id(*id)
|
opts: DialOpts::peer_id(*id).build(),
|
||||||
.condition(dial_opts::PeerCondition::Disconnected)
|
|
||||||
.build(),
|
|
||||||
handler,
|
handler,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -41,8 +41,8 @@ use libp2p_core::{
|
|||||||
multiaddr::Protocol::Ip6, ConnectedPoint, Multiaddr, PeerId,
|
multiaddr::Protocol::Ip6, ConnectedPoint, Multiaddr, PeerId,
|
||||||
};
|
};
|
||||||
use libp2p_swarm::{
|
use libp2p_swarm::{
|
||||||
dial_opts::{self, DialOpts},
|
dial_opts::DialOpts, IntoConnectionHandler, NetworkBehaviour, NetworkBehaviourAction,
|
||||||
IntoConnectionHandler, NetworkBehaviour, NetworkBehaviourAction, NotifyHandler, PollParameters,
|
NotifyHandler, PollParameters,
|
||||||
};
|
};
|
||||||
use wasm_timer::Instant;
|
use wasm_timer::Instant;
|
||||||
|
|
||||||
@ -1143,9 +1143,7 @@ where
|
|||||||
debug!("Connecting to explicit peer {:?}", peer_id);
|
debug!("Connecting to explicit peer {:?}", peer_id);
|
||||||
let handler = self.new_handler();
|
let handler = self.new_handler();
|
||||||
self.events.push_back(NetworkBehaviourAction::Dial {
|
self.events.push_back(NetworkBehaviourAction::Dial {
|
||||||
opts: DialOpts::peer_id(*peer_id)
|
opts: DialOpts::peer_id(*peer_id).build(),
|
||||||
.condition(dial_opts::PeerCondition::Disconnected)
|
|
||||||
.build(),
|
|
||||||
handler,
|
handler,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -1644,9 +1642,7 @@ where
|
|||||||
// dial peer
|
// dial peer
|
||||||
let handler = self.new_handler();
|
let handler = self.new_handler();
|
||||||
self.events.push_back(NetworkBehaviourAction::Dial {
|
self.events.push_back(NetworkBehaviourAction::Dial {
|
||||||
opts: DialOpts::peer_id(peer_id)
|
opts: DialOpts::peer_id(peer_id).build(),
|
||||||
.condition(dial_opts::PeerCondition::Disconnected)
|
|
||||||
.build(),
|
|
||||||
handler,
|
handler,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -26,9 +26,9 @@ use libp2p_core::{
|
|||||||
Multiaddr, PeerId, PublicKey,
|
Multiaddr, PeerId, PublicKey,
|
||||||
};
|
};
|
||||||
use libp2p_swarm::{
|
use libp2p_swarm::{
|
||||||
dial_opts::{self, DialOpts},
|
dial_opts::DialOpts, AddressScore, ConnectionHandler, ConnectionHandlerUpgrErr, DialError,
|
||||||
AddressScore, ConnectionHandler, ConnectionHandlerUpgrErr, DialError, IntoConnectionHandler,
|
IntoConnectionHandler, NegotiatedSubstream, NetworkBehaviour, NetworkBehaviourAction,
|
||||||
NegotiatedSubstream, NetworkBehaviour, NetworkBehaviourAction, NotifyHandler, PollParameters,
|
NotifyHandler, PollParameters,
|
||||||
};
|
};
|
||||||
use lru::LruCache;
|
use lru::LruCache;
|
||||||
use std::{
|
use std::{
|
||||||
@ -196,9 +196,7 @@ impl Identify {
|
|||||||
if self.pending_push.insert(p) && !self.connected.contains_key(&p) {
|
if self.pending_push.insert(p) && !self.connected.contains_key(&p) {
|
||||||
let handler = self.new_handler();
|
let handler = self.new_handler();
|
||||||
self.events.push_back(NetworkBehaviourAction::Dial {
|
self.events.push_back(NetworkBehaviourAction::Dial {
|
||||||
opts: DialOpts::peer_id(p)
|
opts: DialOpts::peer_id(p).build(),
|
||||||
.condition(dial_opts::PeerCondition::Disconnected)
|
|
||||||
.build(),
|
|
||||||
handler,
|
handler,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -565,9 +565,7 @@ where
|
|||||||
kbucket::InsertResult::Pending { disconnected } => {
|
kbucket::InsertResult::Pending { disconnected } => {
|
||||||
let handler = self.new_handler();
|
let handler = self.new_handler();
|
||||||
self.queued_events.push_back(NetworkBehaviourAction::Dial {
|
self.queued_events.push_back(NetworkBehaviourAction::Dial {
|
||||||
opts: DialOpts::peer_id(disconnected.into_preimage())
|
opts: DialOpts::peer_id(disconnected.into_preimage()).build(),
|
||||||
.condition(dial_opts::PeerCondition::Disconnected)
|
|
||||||
.build(),
|
|
||||||
handler,
|
handler,
|
||||||
});
|
});
|
||||||
RoutingUpdate::Pending
|
RoutingUpdate::Pending
|
||||||
@ -1162,7 +1160,6 @@ where
|
|||||||
let handler = self.new_handler();
|
let handler = self.new_handler();
|
||||||
self.queued_events.push_back(NetworkBehaviourAction::Dial {
|
self.queued_events.push_back(NetworkBehaviourAction::Dial {
|
||||||
opts: DialOpts::peer_id(disconnected.into_preimage())
|
opts: DialOpts::peer_id(disconnected.into_preimage())
|
||||||
.condition(dial_opts::PeerCondition::Disconnected)
|
|
||||||
.build(),
|
.build(),
|
||||||
handler,
|
handler,
|
||||||
})
|
})
|
||||||
@ -2342,9 +2339,7 @@ where
|
|||||||
query.inner.pending_rpcs.push((peer_id, event));
|
query.inner.pending_rpcs.push((peer_id, event));
|
||||||
let handler = self.new_handler();
|
let handler = self.new_handler();
|
||||||
self.queued_events.push_back(NetworkBehaviourAction::Dial {
|
self.queued_events.push_back(NetworkBehaviourAction::Dial {
|
||||||
opts: DialOpts::peer_id(peer_id)
|
opts: DialOpts::peer_id(peer_id).build(),
|
||||||
.condition(dial_opts::PeerCondition::Disconnected)
|
|
||||||
.build(),
|
|
||||||
handler,
|
handler,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -66,9 +66,8 @@ use futures::channel::oneshot;
|
|||||||
use handler::{RequestProtocol, RequestResponseHandler, RequestResponseHandlerEvent};
|
use handler::{RequestProtocol, RequestResponseHandler, RequestResponseHandlerEvent};
|
||||||
use libp2p_core::{connection::ConnectionId, ConnectedPoint, Multiaddr, PeerId};
|
use libp2p_core::{connection::ConnectionId, ConnectedPoint, Multiaddr, PeerId};
|
||||||
use libp2p_swarm::{
|
use libp2p_swarm::{
|
||||||
dial_opts::{self, DialOpts},
|
dial_opts::DialOpts, DialError, IntoConnectionHandler, NetworkBehaviour,
|
||||||
DialError, IntoConnectionHandler, NetworkBehaviour, NetworkBehaviourAction, NotifyHandler,
|
NetworkBehaviourAction, NotifyHandler, PollParameters,
|
||||||
PollParameters,
|
|
||||||
};
|
};
|
||||||
use smallvec::SmallVec;
|
use smallvec::SmallVec;
|
||||||
use std::{
|
use std::{
|
||||||
@ -385,9 +384,7 @@ where
|
|||||||
if let Some(request) = self.try_send_request(peer, request) {
|
if let Some(request) = self.try_send_request(peer, request) {
|
||||||
let handler = self.new_handler();
|
let handler = self.new_handler();
|
||||||
self.pending_events.push_back(NetworkBehaviourAction::Dial {
|
self.pending_events.push_back(NetworkBehaviourAction::Dial {
|
||||||
opts: DialOpts::peer_id(*peer)
|
opts: DialOpts::peer_id(*peer).build(),
|
||||||
.condition(dial_opts::PeerCondition::Disconnected)
|
|
||||||
.build(),
|
|
||||||
handler,
|
handler,
|
||||||
});
|
});
|
||||||
self.pending_outbound_requests
|
self.pending_outbound_requests
|
||||||
|
Reference in New Issue
Block a user