diff --git a/llarp/service/endpoint.cpp b/llarp/service/endpoint.cpp index d790aea45..b7f5cb407 100644 --- a/llarp/service/endpoint.cpp +++ b/llarp/service/endpoint.cpp @@ -366,6 +366,17 @@ namespace llarp ++itr; } } + // expire convotags + { + auto itr = m_Sessions.begin(); + while(itr != m_Sessions.end()) + { + if(itr->second.IsExpired(now)) + itr = m_Sessions.erase(itr); + else + ++itr; + } + } } bool @@ -394,7 +405,8 @@ namespace llarp bool Endpoint::OutboundContext::IsDone(llarp_time_t now) const { - return now - lastGoodSend > (DEFAULT_PATH_LIFETIME / 4) && ShouldRemove(); + (void)now; + return AvailablePaths(path::ePathRoleAny) == 0 && ShouldRemove(); } uint64_t diff --git a/llarp/service/endpoint.hpp b/llarp/service/endpoint.hpp index c2eb74594..9f852f657 100644 --- a/llarp/service/endpoint.hpp +++ b/llarp/service/endpoint.hpp @@ -553,6 +553,14 @@ namespace llarp intro.ExtractStatus(introObj); obj.PutObject("intro", introObj); }; + + bool + IsExpired(llarp_time_t now) const + { + if(now <= lastUsed) + return false; + return intro.IsExpired(now); + } }; /// sessions