Move activeConnections to Server

This commit is contained in:
2025-08-21 21:55:19 -04:00
parent 9ee23fdc46
commit 5e8fe590c1
8 changed files with 12 additions and 268 deletions

View File

@@ -17,8 +17,6 @@
#include <unistd.h>
#include <vector>
extern std::atomic<int> activeConnections;
std::shared_ptr<Server> Server::create(const weaseldb::Config &config,
ConnectionHandler &handler) {
// Use std::shared_ptr constructor with private access
@@ -407,7 +405,7 @@ void Server::start_io_threads(std::vector<std::thread> &threads) {
// Check connection limit
if (config_.server.max_connections > 0 &&
activeConnections.load(std::memory_order_relaxed) >=
active_connections_.load(std::memory_order_relaxed) >=
config_.server.max_connections) {
close(fd);
continue;