ensure no client is connected before running max connections test cases

This commit is contained in:
Nicola Murino
2021-05-11 08:04:57 +02:00
parent c8f7fc9bc9
commit b67cd0d3df
6 changed files with 56 additions and 2 deletions

View File

@@ -711,6 +711,11 @@ func (conns *ActiveConnections) RemoveClientConnection(ipAddr string) {
conns.clients.remove(ipAddr)
}
// GetClientConnections returns the total number of client connections
func (conns *ActiveConnections) GetClientConnections() int32 {
return conns.clients.getTotal()
}
// IsNewConnectionAllowed returns false if the maximum number of concurrent allowed connections is exceeded
func (conns *ActiveConnections) IsNewConnectionAllowed(ipAddr string) bool {
if Config.MaxTotalConnections == 0 && Config.MaxPerHostConnections == 0 {