Max connection limit
This commit is contained in:
@@ -85,6 +85,7 @@ void ConfigParser::parse_server_config(const auto &toml_data,
|
||||
parse_field(srv, "accept_threads", config.accept_threads);
|
||||
parse_field(srv, "network_threads", config.network_threads);
|
||||
parse_field(srv, "event_batch_size", config.event_batch_size);
|
||||
parse_field(srv, "max_connections", config.max_connections);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -156,6 +157,14 @@ bool ConfigParser::validate_config(const Config &config) {
|
||||
valid = false;
|
||||
}
|
||||
|
||||
if (config.server.max_connections < 0 ||
|
||||
config.server.max_connections > 100000) {
|
||||
std::cerr << "Configuration error: server.max_connections must be between "
|
||||
"0 and 100000, got "
|
||||
<< config.server.max_connections << std::endl;
|
||||
valid = false;
|
||||
}
|
||||
|
||||
// Validate commit configuration
|
||||
if (config.commit.min_request_id_length < 8 ||
|
||||
config.commit.min_request_id_length > 256) {
|
||||
|
||||
Reference in New Issue
Block a user