Skip to content

Commit

Permalink
don't copy transit DatabaseStore
Browse files Browse the repository at this point in the history
  • Loading branch information
orignal committed Jun 28, 2015
1 parent bf4c333 commit 047c6a9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
6 changes: 1 addition & 5 deletions Tunnel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
6 changes: 1 addition & 5 deletions TunnelEndpoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 047c6a9

Please sign in to comment.