From b02c777390116e65e6e12ffe10f6fa23b7241d5c Mon Sep 17 00:00:00 2001 From: orignal Date: Thu, 10 Jul 2014 08:13:47 -0400 Subject: [PATCH] delete destination if not requested again --- NetDb.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/NetDb.cpp b/NetDb.cpp index 537093b7..c8b0dac2 100644 --- a/NetDb.cpp +++ b/NetDb.cpp @@ -430,6 +430,7 @@ namespace data if (it != m_RequestedDestinations.end ()) { RequestedDestination * dest = it->second; + bool deleteDest = true; if (num > 0) { auto exploratoryPool = i2p::tunnel::tunnels.GetExploratoryPool (); @@ -478,6 +479,7 @@ namespace data // we do if (!dest->IsExcluded (r->GetIdentHash ()) && dest->GetNumExcludedPeers () < 30) // TODO: fix TunnelGateway first { + LogPrint ("Try ", key, " at floodfill ", peerHash); // tell floodfill about us msgs.push_back (i2p::tunnel::TunnelMessageBlock { @@ -492,6 +494,7 @@ namespace data i2p::tunnel::eDeliveryTypeRouter, r->GetIdentHash (), 0, msg }); + deleteDest = false; } } else @@ -512,16 +515,26 @@ namespace data if (!dest->IsLeaseSet ()) // if not LeaseSet { if (!dest->IsExcluded (router) && dest->GetNumExcludedPeers () < 30) + { + LogPrint ("Try ", key, " at floodfill ", peerHash, " directly"); i2p::transports.SendMessage (router, dest->CreateRequestMessage (router)); + deleteDest = false; + } } else LogPrint ("Can't request LeaseSet"); } - } + } } if (outbound && msgs.size () > 0) outbound->SendTunnelDataMsg (msgs); + if (deleteDest) + { + // no more requests for tha destinationation. delete it + delete it->second; + m_RequestedDestinations.erase (it); + } } else {