If we have "max connections" specified, then obey the limit

master
Robinson 2023-12-12 13:24:33 +01:00
parent 98d8321902
commit a706cdb228
No known key found for this signature in database
GPG Key ID: 8E7DB78588BD6F5C
1 changed files with 1 additions and 1 deletions

View File

@ -199,7 +199,7 @@ internal class ServerHandshake<CONNECTION : Connection>(
// VALIDATE:: we are now connected to the client and are going to create a new connection.
val currentCountForIp = connectionsPerIpCounts.get(clientAddress)
if (currentCountForIp >= config.maxConnectionsPerIpAddress) {
if (config.maxConnectionsPerIpAddress in 1..currentCountForIp) {
// decrement it now, since we aren't going to permit this connection (take the extra decrement hit on failure, instead of always)
connectionsPerIpCounts.decrement(clientAddress, currentCountForIp)