2021-03-09 22:24:35 +00:00
|
|
|
#pragma once
|
2019-07-15 09:15:51 +00:00
|
|
|
|
2021-03-09 22:24:35 +00:00
|
|
|
#include <llarp/router_contact.hpp>
|
2019-07-15 09:15:51 +00:00
|
|
|
|
|
|
|
namespace llarp
|
|
|
|
{
|
|
|
|
namespace service
|
|
|
|
{
|
|
|
|
struct Endpoint;
|
|
|
|
|
|
|
|
struct RouterLookupJob
|
|
|
|
{
|
|
|
|
RouterLookupJob(Endpoint* p, RouterLookupHandler h);
|
|
|
|
|
|
|
|
RouterLookupHandler handler;
|
|
|
|
uint64_t txid;
|
|
|
|
llarp_time_t started;
|
|
|
|
|
|
|
|
bool
|
|
|
|
IsExpired(llarp_time_t now) const
|
|
|
|
{
|
2020-04-07 18:38:56 +00:00
|
|
|
if (now < started)
|
2019-07-15 09:15:51 +00:00
|
|
|
return false;
|
2020-02-24 19:40:45 +00:00
|
|
|
return now - started > 30s;
|
2019-07-15 09:15:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2020-04-07 18:38:56 +00:00
|
|
|
InformResult(std::vector<RouterContact> result)
|
2019-07-15 09:15:51 +00:00
|
|
|
{
|
2020-04-07 18:38:56 +00:00
|
|
|
if (handler)
|
2019-07-15 09:15:51 +00:00
|
|
|
handler(result);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
} // namespace service
|
|
|
|
} // namespace llarp
|