mirror of
https://github.com/EvernodeXRPL/hpcore.git
synced 2026-04-29 15:37:59 +00:00
Changed the validation for max_connections and max_known_connections when reading the cfg (#262)
* Changed the validation for max_con and max_known_con when reading the config * Minor comment fix * Improved a code comment
This commit is contained in:
@@ -425,8 +425,8 @@ namespace conf
|
||||
cfg.mesh.max_connections = mesh["max_connections"].as<uint16_t>();
|
||||
cfg.mesh.max_known_connections = mesh["max_known_connections"].as<uint16_t>();
|
||||
cfg.mesh.max_in_connections_per_host = mesh["max_in_connections_per_host"].as<uint16_t>();
|
||||
// If max_connections is greater than max_known_connections then show error and stop execution.
|
||||
if (cfg.mesh.max_known_connections > cfg.mesh.max_connections)
|
||||
// If a value is specified for max_connections then max_known_connections value should not be 0(unlimited) and it should be less or equal than max_connections.
|
||||
if (cfg.mesh.max_connections > 0 && (cfg.mesh.max_known_connections > cfg.mesh.max_connections || cfg.mesh.max_known_connections == 0))
|
||||
{
|
||||
std::cerr << "Invalid configuration values: mesh max_known_connections count should not exceed mesh max_connections." << '\n';
|
||||
return -1;
|
||||
|
||||
Reference in New Issue
Block a user