Browse Source

shared_ptr for lookup messages

pull/218/head
orignal 10 years ago
parent
commit
ff12421d60
  1. 4
      NetDb.cpp
  2. 6
      NetDbRequests.cpp
  3. 2
      NetDbRequests.h

4
NetDb.cpp

@ -590,7 +590,7 @@ namespace data @@ -590,7 +590,7 @@ namespace data
msgs.push_back (i2p::tunnel::TunnelMessageBlock
{
i2p::tunnel::eDeliveryTypeRouter,
nextFloodfill->GetIdentHash (), 0, ToSharedI2NPMessage (msg)
nextFloodfill->GetIdentHash (), 0, msg
});
deleteDest = false;
}
@ -794,7 +794,7 @@ namespace data @@ -794,7 +794,7 @@ namespace data
{
i2p::tunnel::eDeliveryTypeRouter,
floodfill->GetIdentHash (), 0,
ToSharedI2NPMessage (dest->CreateRequestMessage (floodfill, inbound)) // explore
dest->CreateRequestMessage (floodfill, inbound) // explore
});
}
else

6
NetDbRequests.cpp

@ -8,7 +8,7 @@ namespace i2p @@ -8,7 +8,7 @@ namespace i2p
{
namespace data
{
I2NPMessage * RequestedDestination::CreateRequestMessage (std::shared_ptr<const RouterInfo> router,
std::shared_ptr<I2NPMessage> RequestedDestination::CreateRequestMessage (std::shared_ptr<const RouterInfo> router,
std::shared_ptr<const i2p::tunnel::InboundTunnel> replyTunnel)
{
I2NPMessage * msg = i2p::CreateRouterInfoDatabaseLookupMsg (m_Destination,
@ -16,7 +16,7 @@ namespace data @@ -16,7 +16,7 @@ namespace data
&m_ExcludedPeers);
m_ExcludedPeers.insert (router->GetIdentHash ());
m_CreationTime = i2p::util::GetSecondsSinceEpoch ();
return msg;
return ToSharedI2NPMessage (msg);
}
std::shared_ptr<I2NPMessage> RequestedDestination::CreateRequestMessage (const IdentHash& floodfill)
@ -118,7 +118,7 @@ namespace data @@ -118,7 +118,7 @@ namespace data
auto nextFloodfill = netdb.GetClosestFloodfill (dest->GetDestination (), dest->GetExcludedPeers ());
if (nextFloodfill && outbound && inbound)
outbound->SendTunnelDataMsg (nextFloodfill->GetIdentHash (), 0,
ToSharedI2NPMessage (dest->CreateRequestMessage (nextFloodfill, inbound)));
dest->CreateRequestMessage (nextFloodfill, inbound));
else
{
done = true;

2
NetDbRequests.h

@ -28,7 +28,7 @@ namespace data @@ -28,7 +28,7 @@ namespace data
bool IsExploratory () const { return m_IsExploratory; };
bool IsExcluded (const IdentHash& ident) const { return m_ExcludedPeers.count (ident); };
uint64_t GetCreationTime () const { return m_CreationTime; };
I2NPMessage * CreateRequestMessage (std::shared_ptr<const RouterInfo>, std::shared_ptr<const i2p::tunnel::InboundTunnel> replyTunnel);
std::shared_ptr<I2NPMessage> CreateRequestMessage (std::shared_ptr<const RouterInfo>, std::shared_ptr<const i2p::tunnel::InboundTunnel> replyTunnel);
std::shared_ptr<I2NPMessage> CreateRequestMessage (const IdentHash& floodfill);
void SetRequestComplete (const RequestComplete& requestComplete) { m_RequestComplete = requestComplete; };

Loading…
Cancel
Save