From bb5e92a5637da2897054ebd25eb54c58cb3c1ae8 Mon Sep 17 00:00:00 2001
From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com>
Date: Fri, 4 Aug 2023 17:34:30 +0200
Subject: [PATCH] Fix redundant socket closing bug

Cvar 'sv_rcon_maxsockets' is always higher than the actual allowed socket count. Should only check if its count is higher than the cvar.
---
 r5dev/engine/server/sv_rcon.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/r5dev/engine/server/sv_rcon.cpp b/r5dev/engine/server/sv_rcon.cpp
index 034bfc80..49c85e3c 100644
--- a/r5dev/engine/server/sv_rcon.cpp
+++ b/r5dev/engine/server/sv_rcon.cpp
@@ -90,7 +90,7 @@ void CRConServer::Think(void)
 	const int nCount = m_Socket.GetAcceptedSocketCount();
 
 	// Close redundant sockets if there are too many except for whitelisted and authenticated.
-	if (nCount >= sv_rcon_maxsockets->GetInt())
+	if (nCount > sv_rcon_maxsockets->GetInt())
 	{
 		for (m_nConnIndex = nCount - 1; m_nConnIndex >= 0; m_nConnIndex--)
 		{