Browse Source

delete destination if not requested again

pull/81/head
orignal 10 years ago
parent
commit
b02c777390
  1. 13
      NetDb.cpp

13
NetDb.cpp

@ -430,6 +430,7 @@ namespace data
if (it != m_RequestedDestinations.end ()) if (it != m_RequestedDestinations.end ())
{ {
RequestedDestination * dest = it->second; RequestedDestination * dest = it->second;
bool deleteDest = true;
if (num > 0) if (num > 0)
{ {
auto exploratoryPool = i2p::tunnel::tunnels.GetExploratoryPool (); auto exploratoryPool = i2p::tunnel::tunnels.GetExploratoryPool ();
@ -478,6 +479,7 @@ namespace data
// we do // we do
if (!dest->IsExcluded (r->GetIdentHash ()) && dest->GetNumExcludedPeers () < 30) // TODO: fix TunnelGateway first if (!dest->IsExcluded (r->GetIdentHash ()) && dest->GetNumExcludedPeers () < 30) // TODO: fix TunnelGateway first
{ {
LogPrint ("Try ", key, " at floodfill ", peerHash);
// tell floodfill about us // tell floodfill about us
msgs.push_back (i2p::tunnel::TunnelMessageBlock msgs.push_back (i2p::tunnel::TunnelMessageBlock
{ {
@ -492,6 +494,7 @@ namespace data
i2p::tunnel::eDeliveryTypeRouter, i2p::tunnel::eDeliveryTypeRouter,
r->GetIdentHash (), 0, msg r->GetIdentHash (), 0, msg
}); });
deleteDest = false;
} }
} }
else else
@ -512,7 +515,11 @@ namespace data
if (!dest->IsLeaseSet ()) // if not LeaseSet if (!dest->IsLeaseSet ()) // if not LeaseSet
{ {
if (!dest->IsExcluded (router) && dest->GetNumExcludedPeers () < 30) if (!dest->IsExcluded (router) && dest->GetNumExcludedPeers () < 30)
{
LogPrint ("Try ", key, " at floodfill ", peerHash, " directly");
i2p::transports.SendMessage (router, dest->CreateRequestMessage (router)); i2p::transports.SendMessage (router, dest->CreateRequestMessage (router));
deleteDest = false;
}
} }
else else
LogPrint ("Can't request LeaseSet"); LogPrint ("Can't request LeaseSet");
@ -522,6 +529,12 @@ namespace data
if (outbound && msgs.size () > 0) if (outbound && msgs.size () > 0)
outbound->SendTunnelDataMsg (msgs); outbound->SendTunnelDataMsg (msgs);
if (deleteDest)
{
// no more requests for tha destinationation. delete it
delete it->second;
m_RequestedDestinations.erase (it);
}
} }
else else
{ {

Loading…
Cancel
Save