make sure we have a path to the next introduction we want to use

This commit is contained in:
Thomas Winget 2021-06-15 20:53:40 -04:00 committed by Jeff Becker
parent d9cae4a6c6
commit 7f9a60066b
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05
1 changed files with 8 additions and 3 deletions

View File

@ -441,13 +441,18 @@ namespace llarp
return false;
size_t numValidPaths = 0;
ForEachPath([now, &numValidPaths](path::Path_ptr path) {
bool havePathToNextIntro = false;
ForEachPath([now, this, &havePathToNextIntro, &numValidPaths](path::Path_ptr path) {
if (not path->IsReady())
return;
if (not path->intro.ExpiresSoon(now, path::intro_path_spread))
if (not path->intro.ExpiresSoon(now, path::default_lifetime - path::intro_path_spread))
{
numValidPaths++;
if (path->intro.router == m_NextIntro.router)
havePathToNextIntro = true;
}
});
return numValidPaths < numDesiredPaths;
return numValidPaths < numDesiredPaths or not havePathToNextIntro;
}
void