mirror of
https://github.com/oxen-io/lokinet.git
synced 2024-10-31 09:20:21 +00:00
fix dht exploration ;~;
This commit is contained in:
parent
702273427e
commit
d595b51b0b
@ -334,10 +334,9 @@ namespace llarp
|
||||
Context::ExploreNetworkVia(const Key_t& askpeer)
|
||||
{
|
||||
uint64_t txid = ++ids;
|
||||
TXOwner peer(askpeer, txid);
|
||||
TXOwner whoasked(OurKey(), txid);
|
||||
RouterID K;
|
||||
K.Randomize();
|
||||
const TXOwner peer(askpeer, txid);
|
||||
const TXOwner whoasked(OurKey(), txid);
|
||||
const RouterID K(askpeer.as_array());
|
||||
pendingExploreLookups().NewTX(
|
||||
peer, whoasked, K, new ExploreNetworkJob(askpeer.as_array(), this));
|
||||
}
|
||||
@ -650,7 +649,7 @@ namespace llarp
|
||||
{
|
||||
std::vector< RouterID > closer;
|
||||
const Key_t t(target.as_array());
|
||||
std::set< Key_t > found;
|
||||
std::set< Key_t > foundRouters;
|
||||
if(!_nodes)
|
||||
return false;
|
||||
|
||||
@ -666,7 +665,8 @@ namespace llarp
|
||||
// ourKey should never be in the connected list
|
||||
// requester is likely in the connected list
|
||||
// 4 or connection nodes (minus a potential requestor), whatever is less
|
||||
if(!_nodes->GetManyNearExcluding(t, found, nodeCount >= 4 ? 4 : 1,
|
||||
if(!_nodes->GetManyNearExcluding(t, foundRouters,
|
||||
nodeCount >= 4 ? 4 : nodeCount - 1,
|
||||
std::set< Key_t >{ourKey, requester}))
|
||||
{
|
||||
llarp::LogError(
|
||||
@ -675,12 +675,11 @@ namespace llarp
|
||||
nodeCount, " dht peers");
|
||||
return false;
|
||||
}
|
||||
for(const auto& f : found)
|
||||
for(const auto& f : foundRouters)
|
||||
{
|
||||
const RouterID r(f.as_array());
|
||||
if(GetRouter()->ConnectionToRouterAllowed(r))
|
||||
closer.emplace_back(r);
|
||||
closer.emplace_back(f.as_array());
|
||||
}
|
||||
llarp::LogDebug("Gave ", closer.size(), " routers for exploration");
|
||||
reply.emplace_back(new GotRouterMessage(txid, closer, false));
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user