Skip to content

Commit

Permalink
reduced CPU load at floodfill
Browse files Browse the repository at this point in the history
  • Loading branch information
orignal committed Apr 10, 2015
1 parent 9072a01 commit 1d2950b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions NetDb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ namespace data
return;
}

auto floodfill = netdb.GetClosestFloodfill (destination, dest->GetExcludedPeers ());
auto floodfill = GetClosestFloodfill (destination, dest->GetExcludedPeers ());
if (floodfill)
transports.SendMessage (floodfill->GetIdentHash (), dest->CreateRequestMessage (floodfill->GetIdentHash ()));
else
Expand Down Expand Up @@ -914,10 +914,10 @@ namespace data
std::unique_lock<std::mutex> l(m_FloodfillsMutex);
for (auto it: m_Floodfills)
{
if (!it->IsUnreachable () && !excluded.count (it->GetIdentHash ()))
if (!it->IsUnreachable ())
{
XORMetric m = destKey ^ it->GetIdentHash ();
if (m < minMetric)
if (m < minMetric && !excluded.count (it->GetIdentHash ()))
{
minMetric = m;
r = it;
Expand Down Expand Up @@ -981,10 +981,10 @@ namespace data
// must be called from NetDb thread only
for (auto it: m_RouterInfos)
{
if (!it.second->IsFloodfill () && !excluded.count (it.first))
if (!it.second->IsFloodfill ())
{
XORMetric m = destKey ^ it.first;
if (m < minMetric)
if (m < minMetric && !excluded.count (it.first))
{
minMetric = m;
r = it.second;
Expand Down

0 comments on commit 1d2950b

Please sign in to comment.