mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-02-02 06:54:15 +00:00
don't request same RouterInfo twice
This commit is contained in:
parent
4a6847da8d
commit
cd8e9e59fa
11
NetDb.cpp
11
NetDb.cpp
@ -455,7 +455,16 @@ namespace data
|
|||||||
// request RouterInfo directly
|
// request RouterInfo directly
|
||||||
RequestedDestination * dest = CreateRequestedDestination (destination, false);
|
RequestedDestination * dest = CreateRequestedDestination (destination, false);
|
||||||
if (requestComplete)
|
if (requestComplete)
|
||||||
dest->SetRequestComplete (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 ());
|
auto floodfill = GetClosestFloodfill (destination, dest->GetExcludedPeers ());
|
||||||
if (floodfill)
|
if (floodfill)
|
||||||
transports.SendMessage (floodfill->GetIdentHash (), dest->CreateRequestMessage (floodfill->GetIdentHash ()));
|
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);
|
I2NPMessage * CreateRequestMessage (const IdentHash& floodfill);
|
||||||
|
|
||||||
void SetRequestComplete (const RequestComplete& requestComplete) { m_RequestComplete = requestComplete; };
|
void SetRequestComplete (const RequestComplete& requestComplete) { m_RequestComplete = requestComplete; };
|
||||||
|
bool IsRequestComplete () const { return m_RequestComplete != nullptr; };
|
||||||
void Success (std::shared_ptr<RouterInfo> r);
|
void Success (std::shared_ptr<RouterInfo> r);
|
||||||
void Fail ();
|
void Fail ();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user