lokinet/llarp/service/session.cpp

26 lines
700 B
C++
Raw Normal View History

#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;
2019-04-25 23:21:19 +00:00
}
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