diff --git a/Tunnel.cpp b/Tunnel.cpp index feaaddc4..37dd6d67 100644 --- a/Tunnel.cpp +++ b/Tunnel.cpp @@ -207,14 +207,18 @@ namespace tunnel } ZeroHopsInboundTunnel::ZeroHopsInboundTunnel (): - InboundTunnel (std::make_shared ()) + InboundTunnel (std::make_shared ()), + m_NumReceivedBytes (0) { } void ZeroHopsInboundTunnel::SendTunnelDataMsg (std::shared_ptr msg) { - msg->from = shared_from_this (); - m_Endpoint.HandleDecryptedTunnelDataMsg (msg); + if (msg) + { + m_NumReceivedBytes += msg->GetLength (); + HandleI2NPMessage (msg); + } } void ZeroHopsInboundTunnel::Print (std::stringstream& s) const diff --git a/Tunnel.h b/Tunnel.h index 7fa22a63..34d0a0ab 100644 --- a/Tunnel.h +++ b/Tunnel.h @@ -121,10 +121,10 @@ 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 (); }; + virtual size_t GetNumReceivedBytes () const { return m_Endpoint.GetNumReceivedBytes (); }; void Print (std::stringstream& s) const; - protected: + private: TunnelEndpoint m_Endpoint; }; @@ -136,6 +136,11 @@ namespace tunnel ZeroHopsInboundTunnel (); void SendTunnelDataMsg (std::shared_ptr msg); void Print (std::stringstream& s) const; + size_t GetNumReceivedBytes () const { return m_NumReceivedBytes; }; + + private: + + size_t m_NumReceivedBytes; }; class Tunnels