send 3 closest floodfills

This commit is contained in:
orignal 2015-02-01 19:58:26 -05:00
parent b46c3036d8
commit 8ad9f2681c
3 changed files with 20 additions and 14 deletions

View file

@ -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