set limits correctly

pull/720/head
Jeff Becker 5 years ago
parent f48754c45d
commit 7a3c8e5ca0
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05

@ -92,6 +92,8 @@ namespace llarp
/// a set of paths owned by an entity
struct PathSet
{
/// maximum number of paths a path set can maintain
static constexpr size_t max_paths = 32;
/// construct
/// @params numPaths the number of paths to maintain
PathSet(size_t numPaths);

@ -43,20 +43,20 @@ namespace llarp
if(k == "paths")
{
const auto val = atoi(v.c_str());
if(val >= 1)
if(val >= 1 && val <= path::PathSet::max_paths)
{
ep.numPaths = val;
LogInfo(name, " set number of hops to ", ep.numHops);
LogInfo(name, " set number of paths to ", ep.numHops);
}
else
{
LogWarn(name, " invalid number of hops: ", v);
LogWarn(name, " invalid number of paths: ", v);
}
}
if(k == "hops")
{
const auto val = atoi(v.c_str());
if(val >= 1)
if(val >= 1 && val <= path::max_len)
{
ep.numHops = val;
LogInfo(name, " set number of hops to ", ep.numHops);

Loading…
Cancel
Save