mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-21 22:01:34 +00:00
refactor(swarm)!: remove handler
from NetworkBehaviourAction::Dial
(#3328)
We create the `ConnectionId` for the new connection as part of `DialOpts`. This allows `NetworkBehaviour`s to accurately track state regarding their own dial attempts. This patch is the main enabler of https://github.com/libp2p/rust-libp2p/pull/3254. Removing the `handler` field will allow us to deprecate the `NetworkBehaviour::new_handler` function in favor of four new ones that give more control over the connection lifecycle.
This commit is contained in:
@ -31,7 +31,7 @@ use libp2p_core::{Multiaddr, PeerId};
|
||||
use libp2p_swarm::behaviour::FromSwarm;
|
||||
use libp2p_swarm::{
|
||||
dummy, ListenAddresses, NetworkBehaviour, NetworkBehaviourAction, PollParameters,
|
||||
THandlerOutEvent,
|
||||
THandlerInEvent, THandlerOutEvent,
|
||||
};
|
||||
use smallvec::SmallVec;
|
||||
use std::collections::hash_map::{Entry, HashMap};
|
||||
@ -223,7 +223,7 @@ where
|
||||
&mut self,
|
||||
cx: &mut Context<'_>,
|
||||
_: &mut impl PollParameters,
|
||||
) -> Poll<NetworkBehaviourAction<Self::OutEvent, dummy::ConnectionHandler>> {
|
||||
) -> Poll<NetworkBehaviourAction<Self::OutEvent, THandlerInEvent<Self>>> {
|
||||
// Poll ifwatch.
|
||||
while let Poll::Ready(Some(event)) = Pin::new(&mut self.if_watch).poll_next(cx) {
|
||||
match event {
|
||||
|
Reference in New Issue
Block a user