Browse Source

don't request same RouterInfo twice

pull/157/head
orignal 10 years ago
parent
commit
cd8e9e59fa
  1. 9
      NetDb.cpp
  2. 1
      NetDb.h

9
NetDb.cpp

@ -455,7 +455,16 @@ namespace data @@ -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 ()));

1
NetDb.h

@ -42,6 +42,7 @@ namespace data @@ -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 ();

Loading…
Cancel
Save