mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 11:47:48 +02:00
send 3 closest floodfills
This commit is contained in:
parent
b46c3036d8
commit
8ad9f2681c
3 changed files with 20 additions and 14 deletions
24
NetDb.cpp
24
NetDb.cpp
|
@ -664,16 +664,15 @@ namespace data
|
|||
|
||||
I2NPMessage * replyMsg = nullptr;
|
||||
|
||||
auto router = FindRouter (buf);
|
||||
if (router)
|
||||
{
|
||||
auto router = FindRouter (buf);
|
||||
if (router)
|
||||
{
|
||||
LogPrint ("Requested RouterInfo ", key, " found");
|
||||
router->LoadBuffer ();
|
||||
if (router->GetBuffer ())
|
||||
replyMsg = CreateDatabaseStoreMsg (router.get ());
|
||||
}
|
||||
LogPrint ("Requested RouterInfo ", key, " found");
|
||||
router->LoadBuffer ();
|
||||
if (router->GetBuffer ())
|
||||
replyMsg = CreateDatabaseStoreMsg (router.get ());
|
||||
}
|
||||
|
||||
if (!replyMsg)
|
||||
{
|
||||
auto leaseSet = FindLeaseSet (buf);
|
||||
|
@ -693,7 +692,14 @@ namespace data
|
|||
excludedRouters.insert (excluded);
|
||||
excluded += 32;
|
||||
}
|
||||
replyMsg = CreateDatabaseSearchReply (buf, GetClosestFloodfill (buf, excludedRouters).get ());
|
||||
std::vector<IdentHash> routers;
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
auto floodfill = GetClosestFloodfill (buf, excludedRouters);
|
||||
if (floodfill)
|
||||
routers.push_back (floodfill->GetIdentHash ());
|
||||
}
|
||||
replyMsg = CreateDatabaseSearchReply (buf, routers);
|
||||
}
|
||||
else
|
||||
excluded += numExcluded*32; // we don't care about exluded
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue