diff --git a/llarp/router/router.cpp b/llarp/router/router.cpp index 35be802ea..c6a391590 100644 --- a/llarp/router/router.cpp +++ b/llarp/router/router.cpp @@ -1266,7 +1266,7 @@ namespace llarp // remove stale routers nodedb()->VisitInsertedAfter( [&](const RouterContact &rc) { removeStale.insert(rc.pubkey); }, - ((RouterContact::UpdateInterval * 3) / 2) + now); + (RouterContact::UpdateInterval + now + RouterContact::UpdateWindow)); nodedb()->RemoveIf([removeStale](const RouterContact &rc) -> bool { return removeStale.count(rc.pubkey) > 0; }); diff --git a/llarp/router_contact.cpp b/llarp/router_contact.cpp index 6a90ef529..aa04111e3 100644 --- a/llarp/router_contact.cpp +++ b/llarp/router_contact.cpp @@ -33,6 +33,8 @@ namespace llarp #endif /// every 30 minutes an RC is stale and needs updating llarp_time_t RouterContact::UpdateInterval = 30 * 60 * 1000; + // 1 minute window for update + llarp_time_t RouterContact::UpdateWindow = 60 * 1000; NetID::NetID(const byte_t *val) : AlignedBuffer< 8 >() { diff --git a/llarp/router_contact.hpp b/llarp/router_contact.hpp index 4226ab02e..b8ee4bfc8 100644 --- a/llarp/router_contact.hpp +++ b/llarp/router_contact.hpp @@ -70,6 +70,7 @@ namespace llarp static llarp_time_t Lifetime; static llarp_time_t UpdateInterval; + static llarp_time_t UpdateWindow; RouterContact() {