2018-12-12 02:15:08 +00:00
|
|
|
#include <service/lookup.hpp>
|
2019-01-11 01:19:36 +00:00
|
|
|
|
|
|
|
#include <path/path.hpp>
|
2019-01-10 19:41:51 +00:00
|
|
|
#include <util/time.hpp>
|
2019-04-23 14:28:59 +00:00
|
|
|
#include <router/abstractrouter.hpp>
|
2019-09-01 13:26:16 +00:00
|
|
|
#include <util/thread/logic.hpp>
|
2019-07-30 23:42:13 +00:00
|
|
|
#include <utility>
|
2018-08-04 02:59:32 +00:00
|
|
|
|
2018-07-18 03:10:21 +00:00
|
|
|
namespace llarp
|
|
|
|
{
|
2019-02-11 19:45:42 +00:00
|
|
|
struct AbstractRouter;
|
|
|
|
|
2018-07-18 03:10:21 +00:00
|
|
|
namespace service
|
|
|
|
{
|
2020-04-07 18:38:56 +00:00
|
|
|
IServiceLookup::IServiceLookup(ILookupHolder* p, uint64_t tx, std::string n)
|
2019-07-30 23:42:13 +00:00
|
|
|
: m_parent(p), txid(tx), name(std::move(n))
|
2018-08-04 02:59:32 +00:00
|
|
|
{
|
2018-11-19 22:45:37 +00:00
|
|
|
m_created = time_now_ms();
|
2018-08-04 02:59:32 +00:00
|
|
|
p->PutLookup(this, tx);
|
|
|
|
}
|
|
|
|
|
2018-07-18 03:10:21 +00:00
|
|
|
bool
|
2020-04-07 18:38:56 +00:00
|
|
|
IServiceLookup::SendRequestViaPath(path::Path_ptr path, AbstractRouter* r)
|
2018-07-18 03:10:21 +00:00
|
|
|
{
|
|
|
|
auto msg = BuildRequestMessage();
|
2020-04-07 18:38:56 +00:00
|
|
|
if (!msg)
|
2018-07-18 03:10:21 +00:00
|
|
|
return false;
|
2019-04-23 16:13:22 +00:00
|
|
|
endpoint = path->Endpoint();
|
2019-11-14 21:56:01 +00:00
|
|
|
LogicCall(r->logic(), [=]() { path->SendRoutingMessage(*msg, r); });
|
2019-04-23 14:28:59 +00:00
|
|
|
return true;
|
2018-07-18 03:10:21 +00:00
|
|
|
}
|
|
|
|
} // namespace service
|
2018-10-15 15:43:41 +00:00
|
|
|
} // namespace llarp
|