Max connection limit

This commit is contained in:
2025-08-18 14:48:01 -04:00
parent 9f4547d9f7
commit 715941c0d3
3 changed files with 31 additions and 4 deletions

View File

@@ -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) {