2019-01-22 01:14:02 +00:00
|
|
|
#include <dht/explorenetworkjob.hpp>
|
|
|
|
|
|
|
|
#include <dht/context.hpp>
|
|
|
|
#include <dht/messages/findrouter.hpp>
|
|
|
|
#include <router/router.hpp>
|
|
|
|
|
|
|
|
namespace llarp
|
|
|
|
{
|
|
|
|
namespace dht
|
|
|
|
{
|
|
|
|
void
|
|
|
|
ExploreNetworkJob::Start(const TXOwner &peer)
|
|
|
|
{
|
|
|
|
parent->DHTSendTo(peer.node.as_array(), new FindRouterMessage(peer.txid));
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ExploreNetworkJob::SendReply()
|
|
|
|
{
|
|
|
|
llarp::LogInfo("got ", valuesFound.size(), " routers from exploration");
|
2019-01-22 23:50:26 +00:00
|
|
|
|
|
|
|
auto router = parent->GetRouter();
|
|
|
|
using std::placeholders::_1;
|
2019-01-22 01:14:02 +00:00
|
|
|
for(const auto &pk : valuesFound)
|
|
|
|
{
|
|
|
|
// lookup router
|
|
|
|
parent->LookupRouter(
|
2019-01-29 02:16:31 +00:00
|
|
|
pk,
|
|
|
|
std::bind(&AbstractRouter::HandleDHTLookupForExplore, router, pk,
|
|
|
|
_1));
|
2019-01-22 01:14:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} // namespace dht
|
|
|
|
} // namespace llarp
|