mirror of
https://github.com/oxen-io/lokinet.git
synced 2024-11-17 15:25:35 +00:00
27 lines
710 B
C++
27 lines
710 B
C++
#include <service/session.hpp>
|
|
|
|
namespace llarp
|
|
{
|
|
namespace service
|
|
{
|
|
util::StatusObject
|
|
Session::ExtractStatus() const
|
|
{
|
|
util::StatusObject obj{{"lastUsed", to_json(lastUsed)},
|
|
{"replyIntro", replyIntro.ExtractStatus()},
|
|
{"remote", remote.Addr().ToString()},
|
|
{"seqno", seqno},
|
|
{"intro", intro.ExtractStatus()}};
|
|
return obj;
|
|
}
|
|
|
|
bool
|
|
Session::IsExpired(llarp_time_t now, llarp_time_t lifetime) const
|
|
{
|
|
return now > lastUsed
|
|
&& (now - lastUsed > lifetime || intro.IsExpired(now));
|
|
}
|
|
|
|
} // namespace service
|
|
} // namespace llarp
|