Skip to content

Commit

Permalink
add PeerId to ListenFailure
Browse files Browse the repository at this point in the history
  • Loading branch information
jxs committed Jan 8, 2024
1 parent 6b7e34c commit d355e42
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion swarm/src/behaviour.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ pub enum ToSwarm<TOutEvent, TInEvent> {
/// The emphasis on a **new** candidate is important.
/// Protocols MUST take care to only emit a candidate once per "source".
/// For example, the observed address of a TCP connection does not change throughout its lifetime.
/// Thus, only one candidate should be emitted per connection.
/// Thus, only one candidate should be emitted per connection.
///
/// This makes the report frequency of an address a meaningful data-point for consumers of this event.
/// This address will be shared with all [`NetworkBehaviour`]s via [`FromSwarm::NewExternalAddrCandidate`].
Expand Down Expand Up @@ -487,6 +487,7 @@ pub struct ListenFailure<'a> {
pub send_back_addr: &'a Multiaddr,
pub error: &'a ListenError,
pub connection_id: ConnectionId,
pub peer_id: Option<PeerId>,
}

/// [`FromSwarm`] variant that informs the behaviour that a new listener was created.
Expand Down
3 changes: 3 additions & 0 deletions swarm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,7 @@ where
send_back_addr: &send_back_addr,
error: &listen_error,
connection_id: id,
peer_id: Some(peer_id),
},
));

Expand Down Expand Up @@ -854,6 +855,7 @@ where
send_back_addr: &send_back_addr,
error: &error,
connection_id: id,
peer_id: None,
}));
self.pending_swarm_events
.push_back(SwarmEvent::IncomingConnectionError {
Expand Down Expand Up @@ -957,6 +959,7 @@ where
send_back_addr: &send_back_addr,
error: &listen_error,
connection_id,
peer_id: None,
}));

self.pending_swarm_events
Expand Down

0 comments on commit d355e42

Please sign in to comment.