mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2024-11-17 21:26:04 +00:00
don't try another flloofill if request already exists
This commit is contained in:
parent
396aa6944d
commit
b0cf5130a2
@ -127,22 +127,20 @@ namespace data
|
|||||||
if (!ret.second) // not inserted
|
if (!ret.second) // not inserted
|
||||||
{
|
{
|
||||||
dest->SetRequestComplete (nullptr); // don't call requestComplete in destructor
|
dest->SetRequestComplete (nullptr); // don't call requestComplete in destructor
|
||||||
if (requestComplete)
|
dest = ret.first->second; // existing one
|
||||||
|
if (requestComplete && dest->IsActive ())
|
||||||
{
|
{
|
||||||
auto prev = ret.first->second->GetRequestComplete ();
|
auto prev = dest->GetRequestComplete ();
|
||||||
if (prev) // if already set
|
if (prev) // if already set
|
||||||
ret.first->second->SetRequestComplete (
|
dest->SetRequestComplete (
|
||||||
[requestComplete, prev](std::shared_ptr<RouterInfo> r)
|
[requestComplete, prev](std::shared_ptr<RouterInfo> r)
|
||||||
{
|
{
|
||||||
prev (r); // call previous
|
prev (r); // call previous
|
||||||
requestComplete (r); // then new
|
requestComplete (r); // then new
|
||||||
});
|
});
|
||||||
else
|
else
|
||||||
ret.first->second->SetRequestComplete (requestComplete);
|
dest->SetRequestComplete (requestComplete);
|
||||||
}
|
}
|
||||||
if (i2p::util::GetSecondsSinceEpoch () > ret.first->second->GetLastRequestTime () + MIN_REQUEST_TIME)
|
|
||||||
if (!SendNextRequest (ret.first->second)) // try next floodfill
|
|
||||||
m_RequestedDestinations.erase (ret.first); // delete request if failed
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -224,7 +222,7 @@ namespace data
|
|||||||
|
|
||||||
bool NetDbRequests::SendNextRequest (std::shared_ptr<RequestedDestination> dest)
|
bool NetDbRequests::SendNextRequest (std::shared_ptr<RequestedDestination> dest)
|
||||||
{
|
{
|
||||||
if (!dest) return false;
|
if (!dest || !dest->IsActive ()) return false;
|
||||||
bool ret = true;
|
bool ret = true;
|
||||||
auto count = dest->GetNumExcludedPeers ();
|
auto count = dest->GetNumExcludedPeers ();
|
||||||
if (!dest->IsExploratory () && count < MAX_NUM_REQUEST_ATTEMPTS)
|
if (!dest->IsExploratory () && count < MAX_NUM_REQUEST_ATTEMPTS)
|
||||||
|
Loading…
Reference in New Issue
Block a user