diff --git a/protocols/autonat/src/behaviour.rs b/protocols/autonat/src/behaviour.rs index 0eba2d43418a..1b58d701a4d9 100644 --- a/protocols/autonat/src/behaviour.rs +++ b/protocols/autonat/src/behaviour.rs @@ -37,7 +37,7 @@ use libp2p_request_response::{ use libp2p_swarm::{ behaviour::{ AddressChange, ConnectionClosed, ConnectionEstablished, DialFailure, ExpiredListenAddr, - ExternalAddrExpired, FromSwarm, NewExternalAddrOfPeer, + ExternalAddrExpired, FromSwarm, }, ConnectionDenied, ConnectionId, ListenAddresses, NetworkBehaviour, NewExternalAddrCandidate, PollParameters, THandler, THandlerInEvent, THandlerOutEvent, ToSwarm, @@ -589,11 +589,8 @@ impl NetworkBehaviour for Behaviour { self.inner.on_swarm_event(listener_closed) } confirmed @ FromSwarm::ExternalAddrConfirmed(_) => self.inner.on_swarm_event(confirmed), - FromSwarm::NewExternalAddrOfPeer(NewExternalAddrOfPeer { - addr: _addr, - peer_id: _peer_id, - }) => { - todo!(); + new_address @ FromSwarm::NewExternalAddrOfPeer(_) => { + self.inner.on_swarm_event(new_address) } } } diff --git a/swarm/src/behaviour.rs b/swarm/src/behaviour.rs index aae14a6ad446..c1553c88e6fb 100644 --- a/swarm/src/behaviour.rs +++ b/swarm/src/behaviour.rs @@ -323,7 +323,7 @@ pub enum ToSwarm { /// TODO: more documentation needed /// Reports external address of a remote peer to other `NetworkBehaviours` - NewExternalAddrOfPeer { addr: Multiaddr, peer_id: PeerId }, + NewExternalAddrOfPeer { peer_id: PeerId, addr: Multiaddr }, } impl ToSwarm { @@ -576,8 +576,8 @@ pub struct ExternalAddrExpired<'a> { /// [`FromSwarm`] variant that informs the behaviour that a new external address was detected. #[derive(Clone, Copy, Debug)] pub struct NewExternalAddrOfPeer<'a> { - pub addr: &'a Multiaddr, pub peer_id: &'a PeerId, + pub addr: &'a Multiaddr, } impl<'a, Handler> FromSwarm<'a, Handler> {