From ea9aa58471f20a736a6395eb9ace09ce59708b87 Mon Sep 17 00:00:00 2001 From: orignal Date: Sun, 24 Aug 2014 22:32:28 -0400 Subject: [PATCH] fixed crash --- Garlic.cpp | 11 +---------- TunnelGateway.cpp | 10 +++++++--- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/Garlic.cpp b/Garlic.cpp index 09b68f1a..db50b627 100644 --- a/Garlic.cpp +++ b/Garlic.cpp @@ -295,16 +295,7 @@ namespace garlic I2NPMessage * GarlicRouting::WrapSingleMessage (const i2p::data::RoutingDestination& destination, I2NPMessage * msg) { - auto it = m_Sessions.find (destination.GetIdentHash ()); - if (it != m_Sessions.end ()) - { - delete it->second; - m_Sessions.erase (it); - } - GarlicRoutingSession * session = new GarlicRoutingSession (&destination, 0); // not follow-on messages expected - m_Sessions[destination.GetIdentHash ()] = session; - - return session->WrapSingleMessage (msg, nullptr); + return WrapMessage (destination, msg, nullptr); } I2NPMessage * GarlicRouting::WrapMessage (const i2p::data::RoutingDestination& destination, diff --git a/TunnelGateway.cpp b/TunnelGateway.cpp index 4a004edc..1ec7f937 100644 --- a/TunnelGateway.cpp +++ b/TunnelGateway.cpp @@ -148,13 +148,17 @@ namespace tunnel void TunnelGateway::SendTunnelDataMsg (const TunnelMessageBlock& block) { - PutTunnelDataMsg (block); - SendBuffer (); + if (block.data) + { + PutTunnelDataMsg (block); + SendBuffer (); + } } void TunnelGateway::PutTunnelDataMsg (const TunnelMessageBlock& block) { - m_Buffer.PutI2NPMsg (block); + if (block.data) + m_Buffer.PutI2NPMsg (block); } void TunnelGateway::SendBuffer ()