diff --git a/HTTPServer.cpp b/HTTPServer.cpp index 157019de..f4cd7b82 100644 --- a/HTTPServer.cpp +++ b/HTTPServer.cpp @@ -800,7 +800,7 @@ namespace util for (auto it: i2p::tunnel::tunnels.GetOutboundTunnels ()) { - it->GetTunnelConfig ()->Print (s); + it->Print (s); auto state = it->GetState (); if (state == i2p::tunnel::eTunnelStateFailed) s << " " << "Failed"; @@ -812,7 +812,7 @@ namespace util for (auto it: i2p::tunnel::tunnels.GetInboundTunnels ()) { - it.second->GetTunnelConfig ()->Print (s); + it.second->Print (s); auto state = it.second->GetState (); if (state == i2p::tunnel::eTunnelStateFailed) s << " " << "Failed"; @@ -863,7 +863,7 @@ namespace util s << "Tunnels:
"; for (auto it: pool->GetOutboundTunnels ()) { - it->GetTunnelConfig ()->Print (s); + it->Print (s); auto state = it->GetState (); if (state == i2p::tunnel::eTunnelStateFailed) s << " " << "Failed"; @@ -873,7 +873,7 @@ namespace util } for (auto it: pool->GetInboundTunnels ()) { - it->GetTunnelConfig ()->Print (s); + it->Print (s); auto state = it->GetState (); if (state == i2p::tunnel::eTunnelStateFailed) s << " " << "Failed"; diff --git a/Tunnel.cpp b/Tunnel.cpp index e636712e..b899fdf7 100644 --- a/Tunnel.cpp +++ b/Tunnel.cpp @@ -190,6 +190,13 @@ namespace tunnel newMsg->from = shared_from_this (); m_Endpoint.HandleDecryptedTunnelDataMsg (newMsg); } + + void InboundTunnel::Print (std::stringstream& s) const + { + s << "-->" << i2p::data::GetIdentHashAbbreviation (GetNextIdentHash ()) << ":" << GetNextTunnelID (); + s << "-->" << (GetNumHops () - 1) << " hops "; + s << GetTunnelID () << ":me"; + } void OutboundTunnel::SendTunnelDataMsg (const uint8_t * gwHash, uint32_t gwTunnel, std::shared_ptr msg) { @@ -225,6 +232,12 @@ namespace tunnel { LogPrint (eLogError, "Incoming message for outbound tunnel ", GetTunnelID ()); } + + void OutboundTunnel::Print (std::stringstream& s) const + { + s << "me-->" << i2p::data::GetIdentHashAbbreviation (GetNextIdentHash ()) << ":" << GetNextTunnelID (); + s << "-->" << (GetNumHops () - 1) << " hops-->"; + } Tunnels tunnels; diff --git a/Tunnel.h b/Tunnel.h index 3c01eb00..20e02c1b 100644 --- a/Tunnel.h +++ b/Tunnel.h @@ -97,6 +97,7 @@ namespace tunnel void SendTunnelDataMsg (const std::vector& msgs); // multiple messages const i2p::data::IdentHash& GetEndpointIdentHash () const { return m_EndpointIdentHash; }; size_t GetNumSentBytes () const { return m_Gateway.GetNumSentBytes (); }; + void Print (std::stringstream& s) const; // implements TunnelBase void HandleTunnelDataMsg (std::shared_ptr tunnelMsg); @@ -115,6 +116,7 @@ namespace tunnel InboundTunnel (std::shared_ptr config): Tunnel (config), m_Endpoint (true) {}; void HandleTunnelDataMsg (std::shared_ptr msg); size_t GetNumReceivedBytes () const { return m_Endpoint.GetNumReceivedBytes (); }; + void Print (std::stringstream& s) const; private: