|
|
|
@ -132,12 +132,6 @@ namespace llarp
|
|
|
|
|
ctx->ScheduleCleanupTimer();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
Context::LookupTagForPath(const service::Tag &tag, uint64_t txid,
|
|
|
|
|
const llarp::PathID_t &path, const Key_t &askpeer)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::set< service::IntroSet >
|
|
|
|
|
Context::FindRandomIntroSetsWithTagExcluding(
|
|
|
|
|
const service::Tag &tag, size_t max,
|
|
|
|
@ -567,7 +561,8 @@ namespace llarp
|
|
|
|
|
void
|
|
|
|
|
Start(const TXOwner &peer)
|
|
|
|
|
{
|
|
|
|
|
parent->DHTSendTo(peer.node, new FindIntroMessage(target, peer.txid));
|
|
|
|
|
parent->DHTSendTo(peer.node,
|
|
|
|
|
new FindIntroMessage(target, peer.txid, R));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool
|
|
|
|
@ -590,10 +585,10 @@ namespace llarp
|
|
|
|
|
found.insert(remoteTag);
|
|
|
|
|
}
|
|
|
|
|
// collect our local values if we haven't hit a limit
|
|
|
|
|
if(found.size() < 8)
|
|
|
|
|
if(found.size() < 3)
|
|
|
|
|
{
|
|
|
|
|
for(const auto &localTag :
|
|
|
|
|
parent->FindRandomIntroSetsWithTagExcluding(target, 2, found))
|
|
|
|
|
parent->FindRandomIntroSetsWithTagExcluding(target, 1, found))
|
|
|
|
|
{
|
|
|
|
|
found.insert(localTag);
|
|
|
|
|
}
|
|
|
|
@ -616,6 +611,53 @@ namespace llarp
|
|
|
|
|
TXOwner asker(whoasked, whoaskedTX);
|
|
|
|
|
TXOwner peer(askpeer, ++ids);
|
|
|
|
|
pendingTagLookups.NewTX(peer, tag, new TagLookup(asker, tag, this, R));
|
|
|
|
|
llarp::LogInfo("ask ", askpeer, " for ", tag, " on behalf of ", whoasked,
|
|
|
|
|
" R=", R);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct LocalTagLookup : public TagLookup
|
|
|
|
|
{
|
|
|
|
|
PathID_t localPath;
|
|
|
|
|
|
|
|
|
|
LocalTagLookup(const PathID_t &path, uint64_t txid,
|
|
|
|
|
const service::Tag &target, Context *ctx)
|
|
|
|
|
: TagLookup(TXOwner{ctx->OurKey(), txid}, target, ctx, 3)
|
|
|
|
|
, localPath(path)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
SendReply()
|
|
|
|
|
{
|
|
|
|
|
auto path =
|
|
|
|
|
parent->router->paths.GetByUpstream(parent->OurKey(), localPath);
|
|
|
|
|
if(!path)
|
|
|
|
|
{
|
|
|
|
|
llarp::LogWarn(
|
|
|
|
|
"did not send reply for relayed dht request, no such local path "
|
|
|
|
|
"for pathid=",
|
|
|
|
|
localPath);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
routing::DHTMessage msg;
|
|
|
|
|
msg.M.emplace_back(new GotIntroMessage(valuesFound, whoasked.txid));
|
|
|
|
|
if(!path->SendRoutingMessage(&msg, parent->router))
|
|
|
|
|
{
|
|
|
|
|
llarp::LogWarn(
|
|
|
|
|
"failed to send routing message when informing result of dht "
|
|
|
|
|
"request, pathid=",
|
|
|
|
|
localPath);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
Context::LookupTagForPath(const service::Tag &tag, uint64_t txid,
|
|
|
|
|
const llarp::PathID_t &path, const Key_t &askpeer)
|
|
|
|
|
{
|
|
|
|
|
TXOwner peer(askpeer, ++ids);
|
|
|
|
|
pendingTagLookups.NewTX(peer, tag,
|
|
|
|
|
new LocalTagLookup(path, txid, tag, this));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool
|
|
|
|
|