1
1
Fork 0
mirror of https://github.com/oxen-io/lokinet synced 2023-12-14 06:53:00 +01:00
lokinet/llarp/service/tag_lookup_job.cpp
Stephen Shelton 273270916e
The Great Wall of Blame
This commit reflects changes to clang-format rules. Unfortunately,
these rule changes create a massive change to the codebase, which
causes an apparent rewrite of git history.

Git blame's --ignore-rev flag can be used to ignore this commit when
attempting to `git blame` some code.
2020-04-07 12:38:56 -06:00

51 lines
1.1 KiB
C++

#include <service/tag_lookup_job.hpp>
#include <dht/messages/findintro.hpp>
#include <routing/dht_message.hpp>
#include <service/endpoint.hpp>
namespace llarp
{
namespace service
{
bool
CachedTagResult::HandleResponse(const std::set<EncryptedIntroSet>&)
{
return true;
}
void
CachedTagResult::Expire(llarp_time_t now)
{
auto itr = result.begin();
while (itr != result.end())
{
if (itr->IsExpired(now))
{
itr = result.erase(itr);
lastModified = now;
}
else
{
++itr;
}
}
}
std::shared_ptr<routing::IMessage>
CachedTagResult::BuildRequestMessage(uint64_t txid)
{
auto msg = std::make_shared<routing::DHTMessage>();
msg->M.emplace_back(std::make_unique<dht::FindIntroMessage>(tag, txid));
lastRequest = m_parent->Now();
return msg;
}
TagLookupJob::TagLookupJob(Endpoint* parent, CachedTagResult* result)
: IServiceLookup(parent, parent->GenTXID(), "taglookup"), m_result(result)
{
}
} // namespace service
} // namespace llarp