don't request same RouterInfo twice

This commit is contained in:
orignal 2015-02-03 16:14:33 -05:00
parent 4a6847da8d
commit cd8e9e59fa
2 changed files with 11 additions and 1 deletions

View File

@ -455,7 +455,16 @@ namespace data
// request RouterInfo directly
RequestedDestination * dest = CreateRequestedDestination (destination, false);
if (requestComplete)
{
if (dest->IsRequestComplete ()) // if set already
{
LogPrint (eLogWarning, "Destination ", destination.ToBase64(), " is requested already");
requestComplete (nullptr); // TODO: implement it better
return;
}
else
dest->SetRequestComplete (requestComplete);
}
auto floodfill = GetClosestFloodfill (destination, dest->GetExcludedPeers ());
if (floodfill)
transports.SendMessage (floodfill->GetIdentHash (), dest->CreateRequestMessage (floodfill->GetIdentHash ()));

View File

@ -42,6 +42,7 @@ namespace data
I2NPMessage * CreateRequestMessage (const IdentHash& floodfill);
void SetRequestComplete (const RequestComplete& requestComplete) { m_RequestComplete = requestComplete; };
bool IsRequestComplete () const { return m_RequestComplete != nullptr; };
void Success (std::shared_ptr<RouterInfo> r);
void Fail ();