only use alive paths for lookups

only track usage from sessions and don't care about intro timeouts
pull/1624/head
Jeff Becker 3 years ago
parent 0005bee196
commit f108af3d8b
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05

@ -50,7 +50,7 @@ namespace llarp
{ {
--tries; --tries;
const auto path = ep->PickRandomEstablishedPath(); const auto path = ep->PickRandomEstablishedPath();
if (path) if (path and path->IsReady())
paths.emplace(path); paths.emplace(path);
} while (tries > 0 and paths.size() < N); } while (tries > 0 and paths.size() < N);
return paths; return paths;

@ -27,7 +27,7 @@ namespace llarp
const auto lastUsed = std::max(lastSend, lastRecv); const auto lastUsed = std::max(lastSend, lastRecv);
if (lastUsed == 0s) if (lastUsed == 0s)
return intro.IsExpired(now); return intro.IsExpired(now);
return now > lastUsed && (now - lastUsed > lifetime || intro.IsExpired(now)); return now > lastUsed && now - lastUsed > lifetime;
} }
void void

Loading…
Cancel
Save