aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDedicatedTest/sv_rcon.cpp
diff options
context:
space:
mode:
authorKawe Mazidjatari <48657826+Mauler125@users.noreply.github.com>2022-05-13 21:55:41 +0200
committerKawe Mazidjatari <48657826+Mauler125@users.noreply.github.com>2022-05-13 21:55:41 +0200
commit125266d6a3fad806c3cf54e3ad1fd7af727d4c0c (patch)
treec3d6b09ea7bb7357e6789a0be51a3803c13524c3 /NorthstarDedicatedTest/sv_rcon.cpp
parent76ed31a29822e40d157792fcbccc604587c3d790 (diff)
downloadNorthstarLauncher-125266d6a3fad806c3cf54e3ad1fd7af727d4c0c.tar.gz
NorthstarLauncher-125266d6a3fad806c3cf54e3ad1fd7af727d4c0c.zip
Optimize RCON
Don't run CheckForBan each iteration if no failed attempts are made
Diffstat (limited to 'NorthstarDedicatedTest/sv_rcon.cpp')
-rw-r--r--NorthstarDedicatedTest/sv_rcon.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/NorthstarDedicatedTest/sv_rcon.cpp b/NorthstarDedicatedTest/sv_rcon.cpp
index ec2abfca..1dcfff32 100644
--- a/NorthstarDedicatedTest/sv_rcon.cpp
+++ b/NorthstarDedicatedTest/sv_rcon.cpp
@@ -263,6 +263,7 @@ void CRConServer::Authenticate(const cl_rcon::request& cl_request, CConnectedNet
::send(pData->m_hSocket, svWrongPass.c_str(), static_cast<int>(svWrongPass.size()), MSG_NOSIGNAL);
pData->m_bAuthorized = false;
+ pData->m_bValidated = false;
pData->m_nFailedAttempts++;
}
}
@@ -340,6 +341,7 @@ void CRConServer::ProcessMessage(const cl_rcon::request& cl_request)
std::string svMessage = this->Serialize(s_pszNoAuthMessage, "", sv_rcon::response_t::SERVERDATA_RESPONSE_AUTH);
::send(pData->m_hSocket, svMessage.c_str(), static_cast<int>(svMessage.size()), MSG_NOSIGNAL);
+ pData->m_bValidated = false;
pData->m_nIgnoredMessage++;
return;
}
@@ -399,6 +401,12 @@ void CRConServer::Execute(const cl_rcon::request& cl_request) const
//-----------------------------------------------------------------------------
bool CRConServer::CheckForBan(CConnectedNetConsoleData* pData)
{
+ if (pData->m_bValidated)
+ {
+ return false;
+ }
+
+ pData->m_bValidated = true;
CNetAdr2 netAdr2 = m_pSocket->GetAcceptedSocketAddress(m_nConnIndex);
// Check if IP is in the ban vector.