mirror of
https://github.com/oxen-io/lokinet
synced 2023-12-14 06:53:00 +01:00
add 'is_stale' and 'is_outdated' functions to RouterContact
This commit is contained in:
parent
f87c37fbb6
commit
51eab687d3
|
@ -248,6 +248,18 @@ namespace llarp
|
||||||
return delta > 0s ? delta : 0s;
|
return delta > 0s ? delta : 0s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
RouterContact::is_stale(llarp_time_t now) const
|
||||||
|
{
|
||||||
|
return age(now) >= _timestamp.time_since_epoch() + STALE_AGE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
RouterContact::is_outdated(llarp_time_t now) const
|
||||||
|
{
|
||||||
|
return age(now) >= _timestamp.time_since_epoch() + OUTDATED_AGE;
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
RouterContact::expires_within_delta(llarp_time_t now, llarp_time_t dlt) const
|
RouterContact::expires_within_delta(llarp_time_t now, llarp_time_t dlt) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -194,6 +194,12 @@ namespace llarp
|
||||||
llarp_time_t
|
llarp_time_t
|
||||||
age(llarp_time_t now) const;
|
age(llarp_time_t now) const;
|
||||||
|
|
||||||
|
bool
|
||||||
|
is_stale(llarp_time_t now) const;
|
||||||
|
|
||||||
|
bool
|
||||||
|
is_outdated(llarp_time_t now) const;
|
||||||
|
|
||||||
bool
|
bool
|
||||||
other_is_newer(const RouterContact& other) const
|
other_is_newer(const RouterContact& other) const
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue