Skip to content

Commit

Permalink
Rearrange NewExternalAddrOfPeer fields
Browse files Browse the repository at this point in the history
  • Loading branch information
StemCll committed Sep 17, 2023
1 parent 46c75c6 commit 2a92826
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
9 changes: 3 additions & 6 deletions protocols/autonat/src/behaviour.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions swarm/src/behaviour.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ pub enum ToSwarm<TOutEvent, TInEvent> {

/// 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<TOutEvent, TInEventOld> ToSwarm<TOutEvent, TInEventOld> {
Expand Down Expand Up @@ -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> {
Expand Down

0 comments on commit 2a92826

Please sign in to comment.