add handover window to router contact updating

pull/686/head
Jeff Becker 5 years ago
parent 30f6a8ccd2
commit 389c414ee3
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05

@ -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;
});

@ -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 >()
{

@ -70,6 +70,7 @@ namespace llarp
static llarp_time_t Lifetime;
static llarp_time_t UpdateInterval;
static llarp_time_t UpdateWindow;
RouterContact()
{

Loading…
Cancel
Save