Skip to content

Commit

Permalink
Revert "Add addresses field for closing listeners (libp2p#1485)"
Browse files Browse the repository at this point in the history
This reverts commit 7bf5266
  • Loading branch information
folex committed Mar 30, 2020
1 parent c74696b commit 3c183a2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
4 changes: 2 additions & 2 deletions core/src/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,8 +356,8 @@ where
Poll::Ready(ListenersEvent::AddressExpired { listener_id, listen_addr }) => {
return Poll::Ready(NetworkEvent::ExpiredListenerAddress { listener_id, listen_addr })
}
Poll::Ready(ListenersEvent::Closed { listener_id, addresses, reason }) => {
return Poll::Ready(NetworkEvent::ListenerClosed { listener_id, addresses, reason })
Poll::Ready(ListenersEvent::Closed { listener_id, reason }) => {
return Poll::Ready(NetworkEvent::ListenerClosed { listener_id, reason })
}
Poll::Ready(ListenersEvent::Error { listener_id, error }) => {
return Poll::Ready(NetworkEvent::ListenerError { listener_id, error })
Expand Down
6 changes: 2 additions & 4 deletions core/src/network/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ where
ListenerClosed {
/// The listener ID that closed.
listener_id: ListenerId,
/// The addresses that the listener was listening on.
addresses: Vec<Multiaddr>,
/// Reason for the closure. Contains `Ok(())` if the stream produced `None`, or `Err`
/// if the stream produced an error.
reason: Result<(), TTrans::Error>,
Expand Down Expand Up @@ -184,10 +182,9 @@ where
.field("listen_addr", listen_addr)
.finish()
}
NetworkEvent::ListenerClosed { listener_id, addresses, reason } => {
NetworkEvent::ListenerClosed { listener_id, reason } => {
f.debug_struct("ListenerClosed")
.field("listener_id", listener_id)
.field("addresses", addresses)
.field("reason", reason)
.finish()
}
Expand Down Expand Up @@ -345,3 +342,4 @@ where
self.info().to_connected_point()
}
}

5 changes: 1 addition & 4 deletions swarm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -445,11 +445,8 @@ where TBehaviour: NetworkBehaviour<ProtocolsHandler = THandler>,
this.behaviour.inject_expired_listen_addr(&listen_addr);
return Poll::Ready(SwarmEvent::ExpiredListenAddr(listen_addr));
}
Poll::Ready(NetworkEvent::ListenerClosed { listener_id, addresses, reason }) => {
Poll::Ready(NetworkEvent::ListenerClosed { listener_id, reason }) => {
log::debug!("Listener {:?}; Closed by {:?}.", listener_id, reason);
for addr in addresses.iter() {
this.behaviour.inject_expired_listen_addr(addr);
}
this.behaviour.inject_listener_closed(listener_id);
}
Poll::Ready(NetworkEvent::ListenerError { listener_id, error }) =>
Expand Down

0 comments on commit 3c183a2

Please sign in to comment.