Check that [router]min-connections <= [router]max

pull/1186/head
Stephen Shelton 4 years ago
parent 6fd270ba09
commit e06c2e4502
No known key found for this signature in database
GPG Key ID: EE4BADACCE8B631C

@ -79,11 +79,6 @@ namespace llarp
m_maxConnectedRouters = arg;
});
// additional check that min <= max
// TODO: where can we perform this check now?
// if (m_minConnectedRouters > m_maxConnectedRouters)
// throw std::invalid_argument("[router]:min-connections must be less than [router]:max-connections");
conf.defineOption<std::string>("router", "nickname", false, m_nickname,
AssignmentAcceptor(m_nickname));
@ -443,7 +438,12 @@ namespace llarp
}
});
// TODO: hand parsed data to conf, pull out values
conf.acceptAllOptions();
// TODO: better way to support inter-option constraints
if (router.m_maxConnectedRouters < router.m_minConnectedRouters)
throw std::invalid_argument("[router]:min-connections must be <= [router]:max-connections");
return true;
}
catch(const std::exception& e)

Loading…
Cancel
Save