|
|
@ -3,6 +3,10 @@
|
|
|
|
#include <dht/context.hpp>
|
|
|
|
#include <dht/context.hpp>
|
|
|
|
#include <dht/messages/findrouter.hpp>
|
|
|
|
#include <dht/messages/findrouter.hpp>
|
|
|
|
#include <dht/messages/gotrouter.hpp>
|
|
|
|
#include <dht/messages/gotrouter.hpp>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <router/abstractrouter.hpp>
|
|
|
|
|
|
|
|
#include <router/i_rc_lookup_handler.hpp>
|
|
|
|
|
|
|
|
|
|
|
|
#include <utility>
|
|
|
|
#include <utility>
|
|
|
|
|
|
|
|
|
|
|
|
namespace llarp
|
|
|
|
namespace llarp
|
|
|
@ -42,6 +46,7 @@ namespace llarp
|
|
|
|
void
|
|
|
|
void
|
|
|
|
RecursiveRouterLookup::DoNextRequest(const Key_t &peer)
|
|
|
|
RecursiveRouterLookup::DoNextRequest(const Key_t &peer)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
peersAsked.emplace(peer);
|
|
|
|
parent->LookupRouterRecursive(target, whoasked.node, whoasked.txid, peer,
|
|
|
|
parent->LookupRouterRecursive(target, whoasked.node, whoasked.txid, peer,
|
|
|
|
resultHandler);
|
|
|
|
resultHandler);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -49,6 +54,7 @@ namespace llarp
|
|
|
|
void
|
|
|
|
void
|
|
|
|
RecursiveRouterLookup::Start(const TXOwner &peer)
|
|
|
|
RecursiveRouterLookup::Start(const TXOwner &peer)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
peersAsked.emplace(peer.node);
|
|
|
|
parent->DHTSendTo(peer.node.as_array(),
|
|
|
|
parent->DHTSendTo(peer.node.as_array(),
|
|
|
|
new FindRouterMessage(peer.txid, target));
|
|
|
|
new FindRouterMessage(peer.txid, target));
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -61,7 +67,8 @@ namespace llarp
|
|
|
|
RouterContact found;
|
|
|
|
RouterContact found;
|
|
|
|
for(const auto &rc : valuesFound)
|
|
|
|
for(const auto &rc : valuesFound)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(found.OtherIsNewer(rc))
|
|
|
|
if(found.OtherIsNewer(rc)
|
|
|
|
|
|
|
|
&& parent->GetRouter()->rcLookupHandler().CheckRC(rc))
|
|
|
|
found = rc;
|
|
|
|
found = rc;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
valuesFound.clear();
|
|
|
|
valuesFound.clear();
|
|
|
@ -77,9 +84,6 @@ namespace llarp
|
|
|
|
whoasked.node.as_array(),
|
|
|
|
whoasked.node.as_array(),
|
|
|
|
new GotRouterMessage({}, whoasked.txid, valuesFound, false), false);
|
|
|
|
new GotRouterMessage({}, whoasked.txid, valuesFound, false), false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// store this in our nodedb for caching
|
|
|
|
|
|
|
|
if(valuesFound.size() > 0)
|
|
|
|
|
|
|
|
parent->StoreRC(valuesFound[0]);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} // namespace dht
|
|
|
|
} // namespace dht
|
|
|
|
} // namespace llarp
|
|
|
|
} // namespace llarp
|
|
|
|