From 047c6a93a3d949af56bed8e499e4ebe626505b7f Mon Sep 17 00:00:00 2001 From: orignal Date: Sat, 27 Jun 2015 22:02:00 -0400 Subject: [PATCH] don't copy transit DatabaseStore --- Tunnel.cpp | 6 +----- TunnelEndpoint.cpp | 6 +----- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/Tunnel.cpp b/Tunnel.cpp index 74780b6c..b773cbfc 100644 --- a/Tunnel.cpp +++ b/Tunnel.cpp @@ -440,13 +440,9 @@ namespace tunnel LogPrint (eLogDebug, "TunnelGateway of ", (int)len, " bytes for tunnel ", tunnel->GetTunnelID (), ". Msg type ", (int)typeID); if (typeID == eI2NPDatabaseStore || typeID == eI2NPDatabaseSearchReply) - { // transit DatabaseStore my contain new/updated RI // or DatabaseSearchReply with new routers - auto ds = NewI2NPMessage (); - *ds = *msg; // TODO: don't copy once msg is shared_ptr - i2p::data::netdb.PostI2NPMsg (ToSharedI2NPMessage (ds)); - } + i2p::data::netdb.PostI2NPMsg (msg); tunnel->SendTunnelDataMsg (msg); } diff --git a/TunnelEndpoint.cpp b/TunnelEndpoint.cpp index e493e168..a8206d3f 100644 --- a/TunnelEndpoint.cpp +++ b/TunnelEndpoint.cpp @@ -243,12 +243,8 @@ namespace tunnel { auto typeID = msg.data->GetTypeID (); if (typeID == eI2NPDatabaseStore || typeID == eI2NPDatabaseSearchReply ) - { // catch RI or reply with new list of routers - auto ds = NewI2NPShortMessage (); - *ds = *(msg.data); // TODO: don't copy once msg.data is shared_ptr - i2p::data::netdb.PostI2NPMsg (ToSharedI2NPMessage (ds)); - } + i2p::data::netdb.PostI2NPMsg (msg.data); i2p::transport::transports.SendMessage (msg.hash, msg.data); } else // we shouldn't send this message. possible leakage