Browse Source

reduced CPU load at floodfill

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

7
NetDb.cpp

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

Loading…
Cancel
Save