Browse Source

reduced CPU load at floodfill

pull/180/head
orignal 10 years ago
parent
commit
9072a018dd
  1. 31
      NetDb.cpp

31
NetDb.cpp

@ -704,22 +704,27 @@ namespace data
if (!replyMsg) if (!replyMsg)
{ {
LogPrint ("Requested ", key, " not found. ", numExcluded, " excluded"); LogPrint ("Requested ", key, " not found. ", numExcluded, " excluded");
std::set<IdentHash> excludedRouters;
for (int i = 0; i < numExcluded; i++)
{
excludedRouters.insert (excluded);
excluded += 32;
}
std::vector<IdentHash> routers; std::vector<IdentHash> routers;
for (int i = 0; i < 3; i++) if (numExcluded > 0)
{ {
auto floodfill = GetClosestFloodfill (buf, excludedRouters); std::set<IdentHash> excludedRouters;
if (floodfill) for (int i = 0; i < numExcluded; i++)
{ {
routers.push_back (floodfill->GetIdentHash ()); excludedRouters.insert (excluded);
excludedRouters.insert (floodfill->GetIdentHash ()); excluded += 32;
}
for (int i = 0; i < 3; i++)
{
auto floodfill = GetClosestFloodfill (buf, excludedRouters);
if (floodfill)
{
routers.push_back (floodfill->GetIdentHash ());
excludedRouters.insert (floodfill->GetIdentHash ());
}
} }
} }
else
routers = GetClosestFloodfills (buf, 3);
replyMsg = CreateDatabaseSearchReply (buf, routers); replyMsg = CreateDatabaseSearchReply (buf, routers);
} }
} }

Loading…
Cancel
Save