mirror of
https://github.com/oxen-io/lokinet.git
synced 2024-11-17 15:25:35 +00:00
5b1941222b
* update travis ci clang-format to clang-format-9 because we use that now add python3-dev package becuase something inside ci thinks it has python but really does not * try using python3.6 * try working around hot garbage that is travis-ci * add deadsnakes repo for python3.8 * prevent nullptr deference when running in unit tests * move python3.8 to main dependancy matrix and add python3.8 to homebrew deps * add deadsnake apt repo * add deadsnakes and python3.8 back to previous matrix * dev package for python * toggle hive build in ci * dont add pybind11 if not bulding hive * revert setting pyenv shim for travis ci * make native builds on by default except for windows ci * only apply native build being off for windows release target becuase that broke macos
45 lines
1.1 KiB
C++
45 lines
1.1 KiB
C++
#include <dht/explorenetworkjob.hpp>
|
|
|
|
#include <dht/context.hpp>
|
|
#include <dht/messages/findrouter.hpp>
|
|
#include <router/abstractrouter.hpp>
|
|
|
|
#include <nodedb.hpp>
|
|
|
|
#include <tooling/dht_event.hpp>
|
|
|
|
namespace llarp
|
|
{
|
|
namespace dht
|
|
{
|
|
void
|
|
ExploreNetworkJob::Start(const TXOwner& peer)
|
|
{
|
|
auto msg = new FindRouterMessage(peer.txid);
|
|
auto router = parent->GetRouter();
|
|
if (router)
|
|
{
|
|
router->NotifyRouterEvent<tooling::FindRouterSentEvent>(router->pubkey(), *msg);
|
|
}
|
|
parent->DHTSendTo(peer.node.as_array(), msg);
|
|
}
|
|
|
|
void
|
|
ExploreNetworkJob::SendReply()
|
|
{
|
|
llarp::LogDebug("got ", valuesFound.size(), " routers from exploration");
|
|
|
|
auto router = parent->GetRouter();
|
|
using std::placeholders::_1;
|
|
for (const auto& pk : valuesFound)
|
|
{
|
|
// lookup router
|
|
if (router and router->nodedb()->Has(pk))
|
|
continue;
|
|
parent->LookupRouter(
|
|
pk, std::bind(&AbstractRouter::HandleDHTLookupForExplore, router, pk, _1));
|
|
}
|
|
}
|
|
} // namespace dht
|
|
} // namespace llarp
|