mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 21:37:17 +01:00
handle excluded peers in DatabaseLookup
This commit is contained in:
parent
c55ad954bf
commit
4236299879
14
NetDb.cpp
14
NetDb.cpp
|
@ -584,19 +584,27 @@ namespace data
|
||||||
LogPrint ("Number of excluded peers exceeds 512");
|
LogPrint ("Number of excluded peers exceeds 512");
|
||||||
numExcluded = 0; // TODO:
|
numExcluded = 0; // TODO:
|
||||||
}
|
}
|
||||||
excluded += numExcluded*32; // TODO: check excluded list and all zeros (exploratory)
|
|
||||||
|
|
||||||
I2NPMessage * replyMsg = nullptr;
|
I2NPMessage * replyMsg = nullptr;
|
||||||
auto router = FindRouter (buf);
|
auto router = FindRouter (buf);
|
||||||
if (router)
|
if (router)
|
||||||
{
|
{
|
||||||
|
LogPrint ("Requested ", key, " found");
|
||||||
router->LoadBuffer ();
|
router->LoadBuffer ();
|
||||||
replyMsg = CreateDatabaseStoreMsg (router);
|
replyMsg = CreateDatabaseStoreMsg (router);
|
||||||
|
excluded += numExcluded*32; // we don't care about exluded
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::set<IdentHash> excluded; // empty for now
|
LogPrint ("Requested ", key, " not found. ", numExcluded, " excluded");
|
||||||
replyMsg = CreateDatabaseSearchReply (buf, GetClosestFloodfill (buf, excluded));
|
std::set<IdentHash> excludedRouters;
|
||||||
|
for (int i = 0; i < numExcluded; i++)
|
||||||
|
{
|
||||||
|
// TODO: check for all zeroes (exploratory)
|
||||||
|
excludedRouters.insert (excluded);
|
||||||
|
excluded += 32;
|
||||||
|
}
|
||||||
|
replyMsg = CreateDatabaseSearchReply (buf, GetClosestFloodfill (buf, excludedRouters));
|
||||||
}
|
}
|
||||||
if (replyMsg)
|
if (replyMsg)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue