@@ -25,7 +25,7 @@ use std::{
2525
2626use asynchronous_codec:: Framed ;
2727use futures:: { future:: Either , prelude:: * , StreamExt } ;
28- use libp2p_core:: upgrade:: DeniedUpgrade ;
28+ use libp2p_core:: { upgrade:: DeniedUpgrade , PeerId } ;
2929use libp2p_swarm:: {
3030 handler:: {
3131 ConnectionEvent , ConnectionHandler , ConnectionHandlerEvent , DialUpgradeError ,
@@ -89,6 +89,9 @@ pub enum Handler {
8989
9090/// Protocol Handler that manages a single long-lived substream with a peer.
9191pub struct EnabledHandler {
92+ /// Remote `PeerId` for this `ConnectionHandler`.
93+ peer_id : PeerId ,
94+
9295 /// Upgrade configuration for the gossipsub protocol.
9396 listen_protocol : ProtocolConfig ,
9497
@@ -162,8 +165,13 @@ enum OutboundSubstreamState {
162165
163166impl Handler {
164167 /// Builds a new [`Handler`].
165- pub ( crate ) fn new ( protocol_config : ProtocolConfig , message_queue : Queue ) -> Self {
168+ pub ( crate ) fn new (
169+ peer_id : PeerId ,
170+ protocol_config : ProtocolConfig ,
171+ message_queue : Queue ,
172+ ) -> Self {
166173 Handler :: Enabled ( EnabledHandler {
174+ peer_id,
167175 listen_protocol : protocol_config,
168176 inbound_substream : None ,
169177 outbound_substream : None ,
@@ -254,6 +262,7 @@ impl EnabledHandler {
254262 Some ( OutboundSubstreamState :: WaitingOutput ( substream) ) => {
255263 if let Poll :: Ready ( mut message) = Pin :: new ( & mut self . message_queue ) . poll_pop ( cx)
256264 {
265+ tracing:: debug!( peer=%self . peer_id, ?message, "Sending gossipsub message" ) ;
257266 match message {
258267 RpcOut :: Publish {
259268 message : _,
0 commit comments