mirror of https://github.com/oxen-io/lokinet
Use constants for path build timing
This commit is contained in:
parent
230037b9f3
commit
abe4015986
|
@ -1,6 +1,7 @@
|
|||
#ifndef LLARP_CONSTANTS_PATH_HPP
|
||||
#define LLARP_CONSTANTS_PATH_HPP
|
||||
|
||||
#include <chrono>
|
||||
#include <cstddef>
|
||||
|
||||
#include <util/types.hpp>
|
||||
|
@ -17,7 +18,13 @@ namespace llarp
|
|||
/// pad messages to the nearest this many bytes
|
||||
constexpr std::size_t pad_size = 128;
|
||||
/// default path lifetime in ms
|
||||
static constexpr auto default_lifetime = 20min;
|
||||
static constexpr std::chrono::milliseconds default_lifetime = 20min;
|
||||
/// minimum into lifetime we will advertise
|
||||
static constexpr std::chrono::milliseconds min_intro_lifetime =
|
||||
default_lifetime / 2;
|
||||
/// spacing frequency at which we try to build paths for introductions
|
||||
static constexpr std::chrono::milliseconds intro_path_spread =
|
||||
default_lifetime / 4;
|
||||
/// after this many ms a path build times out
|
||||
static constexpr auto build_timeout = 30s;
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ namespace llarp
|
|||
std::set< Introduction > introset;
|
||||
if(!GetCurrentIntroductionsWithFilter(
|
||||
introset, [now](const service::Introduction& intro) -> bool {
|
||||
return not intro.ExpiresSoon(now, path::default_lifetime * 2);
|
||||
return not intro.ExpiresSoon(now, path::min_intro_lifetime);
|
||||
}))
|
||||
{
|
||||
LogWarn("could not publish descriptors for endpoint ", Name(),
|
||||
|
@ -1282,8 +1282,7 @@ namespace llarp
|
|||
if(numBuilding > 0)
|
||||
return false;
|
||||
|
||||
static constexpr auto buildSpread = path::default_lifetime / 4;
|
||||
return ((now - lastBuild) > buildSpread);
|
||||
return ((now - lastBuild) > path::intro_path_spread);
|
||||
}
|
||||
|
||||
std::shared_ptr< Logic >
|
||||
|
|
Loading…
Reference in New Issue