mirror of
https://github.com/PurpleI2P/i2pd
synced 2024-11-10 08:00:38 +03:00
don't request same RouterInfo twice
This commit is contained in:
parent
4a6847da8d
commit
cd8e9e59fa
@ -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
1
NetDb.h
@ -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…
Reference in New Issue
Block a user