add 'is_stale' and 'is_outdated' functions to RouterContact

This commit is contained in:
Thomas Winget 2023-11-28 20:47:20 -05:00
parent f87c37fbb6
commit 51eab687d3
2 changed files with 18 additions and 0 deletions

View File

@ -248,6 +248,18 @@ namespace llarp
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
RouterContact::expires_within_delta(llarp_time_t now, llarp_time_t dlt) const
{

View File

@ -194,6 +194,12 @@ namespace llarp
llarp_time_t
age(llarp_time_t now) const;
bool
is_stale(llarp_time_t now) const;
bool
is_outdated(llarp_time_t now) const;
bool
other_is_newer(const RouterContact& other) const
{