mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 21:37:17 +01:00
reduced CPU load at floodfill
This commit is contained in:
parent
2a997d94bf
commit
9072a018dd
31
NetDb.cpp
31
NetDb.cpp
|
@ -704,22 +704,27 @@ namespace data
|
|||
if (!replyMsg)
|
||||
{
|
||||
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;
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
auto floodfill = GetClosestFloodfill (buf, excludedRouters);
|
||||
if (floodfill)
|
||||
{
|
||||
routers.push_back (floodfill->GetIdentHash ());
|
||||
excludedRouters.insert (floodfill->GetIdentHash ());
|
||||
if (numExcluded > 0)
|
||||
{
|
||||
std::set<IdentHash> excludedRouters;
|
||||
for (int i = 0; i < numExcluded; i++)
|
||||
{
|
||||
excludedRouters.insert (excluded);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue