replaced todo placeholders

This commit is contained in:
Addy Bryant 2022-03-18 11:54:06 -04:00 committed by Joonas Koivunen
parent 7e9da72dc5
commit 085be771fe
3 changed files with 7 additions and 5 deletions

View File

@ -155,11 +155,12 @@ impl Bitswap {
/// Called from Kademlia behaviour.
pub fn connect(&mut self, peer_id: PeerId) {
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(PeerCondition::Disconnected)
.build(),
handler: todo!(),
handler,
});
}
}

View File

@ -13,8 +13,7 @@ use libp2p::core::{
};
use libp2p::floodsub::{Floodsub, FloodsubConfig, FloodsubEvent, FloodsubMessage, Topic};
use libp2p::swarm::{
ConnectionHandler, DialError, IntoConnectionHandler, NetworkBehaviour, NetworkBehaviourAction,
PollParameters,
ConnectionHandler, DialError, NetworkBehaviour, NetworkBehaviourAction, PollParameters,
};
/// Currently a thin wrapper around Floodsub, perhaps supporting both Gossipsub and Floodsub later.

View File

@ -111,13 +111,14 @@ impl SwarmApi {
.connect_registry
.create_subscription(addr.clone().into(), None);
let handler = self.new_handler();
self.events.push_back(NetworkBehaviourAction::Dial {
// rationale: this is sort of explicit command, perhaps the old address is no longer
// valid. Always would be even better but it's bugged at the moment.
opts: DialOpts::peer_id(addr.peer_id)
.condition(PeerCondition::NotDialing)
.build(),
handler: todo!(),
handler,
});
self.pending_addresses
@ -308,11 +309,12 @@ impl NetworkBehaviour for SwarmApi {
if self.pending_addresses.contains_key(&peer_id) {
// it is possible that these addresses have not been tried yet; they will be asked
// for soon.
let handler = self.new_handler();
self.events.push_back(swarm::NetworkBehaviourAction::Dial {
opts: DialOpts::peer_id(peer_id)
.condition(PeerCondition::NotDialing)
.build(),
handler: todo!(),
handler,
});
}