summaryrefslogtreecommitdiffhomepage
path: root/config.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'config.cpp')
-rw-r--r--config.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/config.cpp b/config.cpp
index d59156f..afb5cd2 100644
--- a/config.cpp
+++ b/config.cpp
@@ -14,6 +14,7 @@ namespace {
const uint64_t default_maxage{0}; // timeout in seconds; 0 = no timeout
const std::string default_listen {"::1:9000"};
const int default_threads{1};
+ const int default_max_connections{1000};
}
Config::Config(const std::string& config_filename):
@@ -21,7 +22,8 @@ Config::Config(const std::string& config_filename):
m_maxage{default_maxage},
m_listenAddress{"::1"},
m_listenPort{9000},
- m_threads{default_threads}
+ m_threads{default_threads},
+ m_max_connections{default_max_connections}
{
try {
@@ -42,6 +44,8 @@ Config::Config(const std::string& config_filename):
throw std::runtime_error("Bad listen port: "s + std::to_string(m_listenPort));
m_threads = tree.get<int>("config.threads", default_threads);
+
+ m_max_connections = tree.get<int>("config.maxconnections", default_max_connections);
} catch (const std::exception& ex) {
std::cerr << "Error reading config file " << config_filename << ". Using defaults." << std::endl;
}
@@ -71,3 +75,9 @@ int Config::getThreads() const
{
return m_threads;
}
+
+int Config::getMaxConnections() const
+{
+ return m_max_connections;
+}
+