mirror of
https://github.com/oxen-io/lokinet.git
synced 2024-11-11 07:10:36 +00:00
7caa87862e
All #ifndef guards on headers have been removed, I think, in favor of #pragma once Headers are now included as `#include "filename"` if the included file resides in the same directory as the file including it, or any subdirectory therein. Otherwise they are included as `#include <project/top/dir/relative/path/filename>` The above does not include system/os headers.
45 lines
1.1 KiB
C++
45 lines
1.1 KiB
C++
#include "explorenetworkjob.hpp"
|
|
|
|
#include "context.hpp"
|
|
#include <llarp/dht/messages/findrouter.hpp>
|
|
#include <llarp/router/abstractrouter.hpp>
|
|
|
|
#include <llarp/nodedb.hpp>
|
|
|
|
#include <llarp/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
|