|
|
|
@ -50,7 +50,7 @@ namespace llarp
|
|
|
|
|
void
|
|
|
|
|
LookupIntroSetRecursive(
|
|
|
|
|
const Key_t& target, const Key_t& whoasked, uint64_t whoaskedTX,
|
|
|
|
|
const Key_t& askpeer, uint64_t R,
|
|
|
|
|
const Key_t& askpeer, uint64_t recursionDepth,
|
|
|
|
|
service::EncryptedIntroSetLookupHandler result = nullptr) override;
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
@ -94,7 +94,7 @@ namespace llarp
|
|
|
|
|
void
|
|
|
|
|
LookupIntroSetForPath(const Key_t& addr, uint64_t txid,
|
|
|
|
|
const llarp::PathID_t& path, const Key_t& askpeer,
|
|
|
|
|
uint64_t R) override;
|
|
|
|
|
uint64_t recursionDepth) override;
|
|
|
|
|
|
|
|
|
|
/// send a dht message to peer, if keepalive is true then keep the session
|
|
|
|
|
/// with that peer alive for 10 seconds
|
|
|
|
@ -488,17 +488,17 @@ namespace llarp
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
Context::Init(const Key_t& us, AbstractRouter* r,
|
|
|
|
|
Context::Init(const Key_t& us, AbstractRouter* router,
|
|
|
|
|
llarp_time_t exploreInterval)
|
|
|
|
|
{
|
|
|
|
|
router = r;
|
|
|
|
|
router = router;
|
|
|
|
|
ourKey = us;
|
|
|
|
|
_nodes = std::make_unique< Bucket< RCNode > >(ourKey, llarp::randint);
|
|
|
|
|
_services = std::make_unique< Bucket< ISNode > >(ourKey, llarp::randint);
|
|
|
|
|
llarp::LogDebug("initialize dht with key ", ourKey);
|
|
|
|
|
// start exploring
|
|
|
|
|
|
|
|
|
|
r->logic()->call_later(
|
|
|
|
|
router->logic()->call_later(
|
|
|
|
|
exploreInterval,
|
|
|
|
|
std::bind(&llarp::dht::Context::handle_explore_timer, this,
|
|
|
|
|
exploreInterval));
|
|
|
|
@ -541,14 +541,15 @@ namespace llarp
|
|
|
|
|
void
|
|
|
|
|
Context::LookupIntroSetForPath(const Key_t& addr, uint64_t txid,
|
|
|
|
|
const llarp::PathID_t& path,
|
|
|
|
|
const Key_t& askpeer, uint64_t R)
|
|
|
|
|
const Key_t& askpeer,
|
|
|
|
|
uint64_t recursionDepth)
|
|
|
|
|
{
|
|
|
|
|
TXOwner asker(OurKey(), txid);
|
|
|
|
|
TXOwner peer(askpeer, ++ids);
|
|
|
|
|
_pendingIntrosetLookups.NewTX(
|
|
|
|
|
peer, asker, addr,
|
|
|
|
|
new LocalServiceAddressLookup(path, txid, addr, this, askpeer),
|
|
|
|
|
((R + 1) * 2000));
|
|
|
|
|
((recursionDepth + 1) * 2000));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
@ -568,15 +569,15 @@ namespace llarp
|
|
|
|
|
void
|
|
|
|
|
Context::LookupIntroSetRecursive(
|
|
|
|
|
const Key_t& addr, const Key_t& whoasked, uint64_t txid,
|
|
|
|
|
const Key_t& askpeer, uint64_t R,
|
|
|
|
|
const Key_t& askpeer, uint64_t recursionDepth,
|
|
|
|
|
service::EncryptedIntroSetLookupHandler handler)
|
|
|
|
|
{
|
|
|
|
|
TXOwner asker(whoasked, txid);
|
|
|
|
|
TXOwner peer(askpeer, ++ids);
|
|
|
|
|
_pendingIntrosetLookups.NewTX(
|
|
|
|
|
peer, asker, addr,
|
|
|
|
|
new ServiceAddressLookup(asker, addr, this, R, handler),
|
|
|
|
|
((R + 1) * 2000));
|
|
|
|
|
new ServiceAddressLookup(asker, addr, this, recursionDepth, handler),
|
|
|
|
|
((recursionDepth + 1) * 2000));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
@ -636,11 +637,11 @@ namespace llarp
|
|
|
|
|
}
|
|
|
|
|
for(const auto& f : foundRouters)
|
|
|
|
|
{
|
|
|
|
|
const RouterID r = f.as_array();
|
|
|
|
|
const RouterID id = f.as_array();
|
|
|
|
|
// discard shit routers
|
|
|
|
|
if(router->routerProfiling().IsBadForConnect(r))
|
|
|
|
|
if(router->routerProfiling().IsBadForConnect(id))
|
|
|
|
|
continue;
|
|
|
|
|
closer.emplace_back(r);
|
|
|
|
|
closer.emplace_back(id);
|
|
|
|
|
}
|
|
|
|
|
llarp::LogDebug("Gave ", closer.size(), " routers for exploration");
|
|
|
|
|
reply.emplace_back(new GotRouterMessage(txid, closer, false));
|
|
|
|
|