2019-04-21 18:38:30 +00:00
|
|
|
#include <service/session.hpp>
|
|
|
|
|
|
|
|
namespace llarp
|
|
|
|
{
|
|
|
|
namespace service
|
|
|
|
{
|
|
|
|
util::StatusObject
|
|
|
|
Session::ExtractStatus() const
|
|
|
|
{
|
2020-02-25 17:05:13 +00:00
|
|
|
util::StatusObject obj{{"lastUsed", to_json(lastUsed)},
|
2019-04-21 18:38:30 +00:00
|
|
|
{"replyIntro", replyIntro.ExtractStatus()},
|
|
|
|
{"remote", remote.Addr().ToString()},
|
|
|
|
{"seqno", seqno},
|
|
|
|
{"intro", intro.ExtractStatus()}};
|
|
|
|
return obj;
|
2019-04-25 23:21:19 +00:00
|
|
|
}
|
2019-06-14 12:49:45 +00:00
|
|
|
|
|
|
|
bool
|
|
|
|
Session::IsExpired(llarp_time_t now, llarp_time_t lifetime) const
|
|
|
|
{
|
2019-09-19 20:28:12 +00:00
|
|
|
return now > lastUsed
|
|
|
|
&& (now - lastUsed > lifetime || intro.IsExpired(now));
|
2019-06-14 12:49:45 +00:00
|
|
|
}
|
|
|
|
|
2019-04-21 18:38:30 +00:00
|
|
|
} // namespace service
|
|
|
|
} // namespace llarp
|