mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-31 04:44:13 +00:00
reduced CPU load at floodfill
This commit is contained in:
parent
9072a018dd
commit
1d2950b4a7
10
NetDb.cpp
10
NetDb.cpp
@ -445,7 +445,7 @@ namespace data
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto floodfill = netdb.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 ()));
|
||||||
else
|
else
|
||||||
@ -914,10 +914,10 @@ namespace data
|
|||||||
std::unique_lock<std::mutex> l(m_FloodfillsMutex);
|
std::unique_lock<std::mutex> l(m_FloodfillsMutex);
|
||||||
for (auto it: m_Floodfills)
|
for (auto it: m_Floodfills)
|
||||||
{
|
{
|
||||||
if (!it->IsUnreachable () && !excluded.count (it->GetIdentHash ()))
|
if (!it->IsUnreachable ())
|
||||||
{
|
{
|
||||||
XORMetric m = destKey ^ it->GetIdentHash ();
|
XORMetric m = destKey ^ it->GetIdentHash ();
|
||||||
if (m < minMetric)
|
if (m < minMetric && !excluded.count (it->GetIdentHash ()))
|
||||||
{
|
{
|
||||||
minMetric = m;
|
minMetric = m;
|
||||||
r = it;
|
r = it;
|
||||||
@ -981,10 +981,10 @@ namespace data
|
|||||||
// must be called from NetDb thread only
|
// must be called from NetDb thread only
|
||||||
for (auto it: m_RouterInfos)
|
for (auto it: m_RouterInfos)
|
||||||
{
|
{
|
||||||
if (!it.second->IsFloodfill () && !excluded.count (it.first))
|
if (!it.second->IsFloodfill ())
|
||||||
{
|
{
|
||||||
XORMetric m = destKey ^ it.first;
|
XORMetric m = destKey ^ it.first;
|
||||||
if (m < minMetric)
|
if (m < minMetric && !excluded.count (it.first))
|
||||||
{
|
{
|
||||||
minMetric = m;
|
minMetric = m;
|
||||||
r = it.second;
|
r = it.second;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user