mirror of
https://github.com/oxen-io/lokinet.git
synced 2024-11-15 12:13:24 +00:00
add handover window to router contact updating
This commit is contained in:
parent
30f6a8ccd2
commit
389c414ee3
@ -1266,7 +1266,7 @@ namespace llarp
|
|||||||
// remove stale routers
|
// remove stale routers
|
||||||
nodedb()->VisitInsertedAfter(
|
nodedb()->VisitInsertedAfter(
|
||||||
[&](const RouterContact &rc) { removeStale.insert(rc.pubkey); },
|
[&](const RouterContact &rc) { removeStale.insert(rc.pubkey); },
|
||||||
((RouterContact::UpdateInterval * 3) / 2) + now);
|
(RouterContact::UpdateInterval + now + RouterContact::UpdateWindow));
|
||||||
nodedb()->RemoveIf([removeStale](const RouterContact &rc) -> bool {
|
nodedb()->RemoveIf([removeStale](const RouterContact &rc) -> bool {
|
||||||
return removeStale.count(rc.pubkey) > 0;
|
return removeStale.count(rc.pubkey) > 0;
|
||||||
});
|
});
|
||||||
|
@ -33,6 +33,8 @@ namespace llarp
|
|||||||
#endif
|
#endif
|
||||||
/// every 30 minutes an RC is stale and needs updating
|
/// every 30 minutes an RC is stale and needs updating
|
||||||
llarp_time_t RouterContact::UpdateInterval = 30 * 60 * 1000;
|
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 >()
|
NetID::NetID(const byte_t *val) : AlignedBuffer< 8 >()
|
||||||
{
|
{
|
||||||
|
@ -70,6 +70,7 @@ namespace llarp
|
|||||||
|
|
||||||
static llarp_time_t Lifetime;
|
static llarp_time_t Lifetime;
|
||||||
static llarp_time_t UpdateInterval;
|
static llarp_time_t UpdateInterval;
|
||||||
|
static llarp_time_t UpdateWindow;
|
||||||
|
|
||||||
RouterContact()
|
RouterContact()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user