do direct lookup when in endgame scenario as client when looking for router

pull/686/head
Jeff Becker 5 years ago
parent a225759c0f
commit 5eb7ec493f
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05

@ -1216,18 +1216,23 @@ namespace llarp
resultHandler = std::bind(&Router::HandleRouterLookupForExpireUpdate,
this, remote, std::placeholders::_1);
}
if(IsServiceNode())
{
dht()->impl->LookupRouter(remote, resultHandler);
}
else
// if we are a client try using the hidden service endpoints
if(!IsServiceNode())
{
bool sent = false;
_hiddenServiceContext.ForEachService(
[=](const std::string &,
[&](const std::string &,
const std::shared_ptr< service::Endpoint > &ep) -> bool {
return !ep->LookupRouterAnon(remote, resultHandler);
const bool success = ep->LookupRouterAnon(remote, resultHandler);
sent |= success;
return !success;
});
if(sent)
return;
}
// if we are service node or failed to use hidden service endpoints as
// client do a direct lookup
dht()->impl->LookupRouter(remote, resultHandler);
}
bool

Loading…
Cancel
Save