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
|
|
|
|
2023-11-02 12:30:38 +00:00
|
|
|
namespace llarp::service
|
2019-07-15 09:15:51 +00:00
|
|
|
{
|
2023-11-02 12:30:38 +00:00
|
|
|
struct Endpoint;
|
2019-07-15 09:15:51 +00:00
|
|
|
|
2023-11-02 12:30:38 +00:00
|
|
|
struct RouterLookupJob
|
|
|
|
{
|
|
|
|
RouterLookupJob(Endpoint* p, RouterLookupHandler h);
|
2019-07-15 09:15:51 +00:00
|
|
|
|
2023-11-02 12:30:38 +00:00
|
|
|
RouterLookupHandler handler;
|
|
|
|
uint64_t txid;
|
|
|
|
llarp_time_t started;
|
2019-07-15 09:15:51 +00:00
|
|
|
|
2023-11-02 12:30:38 +00:00
|
|
|
bool
|
|
|
|
IsExpired(llarp_time_t now) const
|
|
|
|
{
|
|
|
|
if (now < started)
|
|
|
|
return false;
|
|
|
|
return now - started > 30s;
|
|
|
|
}
|
2019-07-15 09:15:51 +00:00
|
|
|
|
2023-11-02 12:30:38 +00:00
|
|
|
void
|
|
|
|
InformResult(std::vector<RemoteRC> result)
|
|
|
|
{
|
|
|
|
if (handler)
|
|
|
|
handler(result);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
} // namespace llarp::service
|