Use Int64 for TcpServerDispatcher::totalConnections(), to prevent overflow

This commit is contained in:
Étienne Dupuis 2024-08-20 16:51:58 +02:00 committed by Matej Kenda
parent e4aaeacea8
commit 63bed8c8d3
4 changed files with 10 additions and 10 deletions

View File

@ -175,7 +175,7 @@ public:
int maxThreads() const; int maxThreads() const;
/// Returns the maximum number of threads available. /// Returns the maximum number of threads available.
int totalConnections() const; Int64 totalConnections() const;
/// Returns the total number of handled connections. /// Returns the total number of handled connections.
int currentConnections() const; int currentConnections() const;

View File

@ -68,7 +68,7 @@ public:
int maxThreads() const; int maxThreads() const;
/// Returns the maximum number of threads available. /// Returns the maximum number of threads available.
int totalConnections() const; Int64 totalConnections() const;
/// Returns the total number of handled connections. /// Returns the total number of handled connections.
int currentConnections() const; int currentConnections() const;
@ -104,7 +104,7 @@ private:
std::atomic<int> _rc; std::atomic<int> _rc;
TCPServerParams::Ptr _pParams; TCPServerParams::Ptr _pParams;
std::atomic<int> _currentThreads; std::atomic<int> _currentThreads;
std::atomic<int> _totalConnections; std::atomic<Int64> _totalConnections;
std::atomic<int> _currentConnections; std::atomic<int> _currentConnections;
std::atomic<int> _maxConcurrentConnections; std::atomic<int> _maxConcurrentConnections;
std::atomic<int> _refusedConnections; std::atomic<int> _refusedConnections;

View File

@ -185,7 +185,7 @@ int TCPServer::maxThreads() const
} }
int TCPServer::totalConnections() const Int64 TCPServer::totalConnections() const
{ {
return _pDispatcher->totalConnections(); return _pDispatcher->totalConnections();
} }

View File

@ -195,7 +195,7 @@ int TCPServerDispatcher::maxThreads() const
} }
int TCPServerDispatcher::totalConnections() const Int64 TCPServerDispatcher::totalConnections() const
{ {
return _totalConnections; return _totalConnections;
} }