protocols/ping: Log remote PeerId instead of payload (#2608)

This commit is contained in:
Elvis
2022-04-07 21:37:02 +02:00
committed by GitHub
parent 2ad905f35a
commit f5b982a13b
2 changed files with 8 additions and 4 deletions

View File

@ -120,6 +120,14 @@ impl NetworkBehaviour for Behaviour {
_: &mut impl PollParameters,
) -> Poll<NetworkBehaviourAction<Self::OutEvent, Self::ConnectionHandler>> {
if let Some(e) = self.events.pop_back() {
let Event { result, peer } = &e;
match result {
Ok(Success::Ping { .. }) => log::debug!("Ping sent to {:?}", peer),
Ok(Success::Pong) => log::debug!("Ping received from {:?}", peer),
_ => {}
}
Poll::Ready(NetworkBehaviourAction::GenerateEvent(e))
} else {
Poll::Pending