diff --git a/bitswap/src/behaviour.rs b/bitswap/src/behaviour.rs index 926a14d4..80fed485 100644 --- a/bitswap/src/behaviour.rs +++ b/bitswap/src/behaviour.rs @@ -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, }); } } diff --git a/src/p2p/pubsub.rs b/src/p2p/pubsub.rs index 6f5f4b2e..eb277b74 100644 --- a/src/p2p/pubsub.rs +++ b/src/p2p/pubsub.rs @@ -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. diff --git a/src/p2p/swarm.rs b/src/p2p/swarm.rs index 3e67bfcc..f0a2cdc8 100644 --- a/src/p2p/swarm.rs +++ b/src/p2p/swarm.rs @@ -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, }); }