mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 16:34:13 +00: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)
|
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…
x
Reference in New Issue
Block a user