From f69ccb73a898e75e50fe82e7121fdd7761c93b93 Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Sat, 1 May 2021 08:54:46 -0400 Subject: [PATCH] limit path reanimation * wait for a limited time for dead paths to reanimate and then remove them after that forever --- llarp/path/path.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/llarp/path/path.cpp b/llarp/path/path.cpp index c870cfa20..1cbd056e5 100644 --- a/llarp/path/path.cpp +++ b/llarp/path/path.cpp @@ -499,6 +499,9 @@ namespace llarp } } + /// how long we wait for a path to become active again after it times out + constexpr auto PathReanimationTimeout = 45s; + bool Path::Expired(llarp_time_t now) const { @@ -506,7 +509,11 @@ namespace llarp return true; if (_status == ePathBuilding) return false; - if (_status == ePathEstablished || _status == ePathTimeout) + if (_status == ePathTimeout) + { + return now >= m_LastRecvMessage + PathReanimationTimeout; + } + if (_status == ePathEstablished) { return now >= ExpireTime(); }