Engine: rcon code readability improvement

Remove the else statement since it will always be else there.
This commit is contained in:
Kawe Mazidjatari 2024-04-01 01:04:27 +02:00
parent ff9261b773
commit f5fcf8bd7a

View File

@ -382,37 +382,36 @@ void CRConServer::Authenticate(const cl_rcon::request& request, CConnectedNetCon
{
return;
}
else // Authorize.
// Authorize.
if (Comparator(request.requestmsg()))
{
if (Comparator(request.requestmsg()))
data.m_bAuthorized = true;
if (++m_nAuthConnections >= sv_rcon_maxconnections.GetInt())
{
data.m_bAuthorized = true;
if (++m_nAuthConnections >= sv_rcon_maxconnections.GetInt())
{
m_Socket.CloseListenSocket();
CloseNonAuthConnection();
}
const char* pSendLogs = (!sv_rcon_sendlogs.GetBool() || data.m_bInputOnly) ? "0" : "1";
SendEncode(data.m_hSocket, s_AuthMessage, pSendLogs,
sv_rcon::response_t::SERVERDATA_RESPONSE_AUTH, static_cast<int>(eDLL_T::NETCON));
m_Socket.CloseListenSocket();
CloseNonAuthConnection();
}
else // Bad password.
const char* pSendLogs = (!sv_rcon_sendlogs.GetBool() || data.m_bInputOnly) ? "0" : "1";
SendEncode(data.m_hSocket, s_AuthMessage, pSendLogs,
sv_rcon::response_t::SERVERDATA_RESPONSE_AUTH, static_cast<int>(eDLL_T::NETCON));
}
else // Bad password.
{
const netadr_t& netAdr = m_Socket.GetAcceptedSocketAddress(m_nConnIndex);
if (sv_rcon_debug.GetBool())
{
const netadr_t& netAdr = m_Socket.GetAcceptedSocketAddress(m_nConnIndex);
if (sv_rcon_debug.GetBool())
{
Msg(eDLL_T::SERVER, "Bad RCON password attempt from '%s'\n", netAdr.ToString());
}
SendEncode(data.m_hSocket, s_WrongPwMessage, "",
sv_rcon::response_t::SERVERDATA_RESPONSE_AUTH, static_cast<int>(eDLL_T::NETCON));
data.m_bAuthorized = false;
data.m_bValidated = false;
data.m_nFailedAttempts++;
Msg(eDLL_T::SERVER, "Bad RCON password attempt from '%s'\n", netAdr.ToString());
}
SendEncode(data.m_hSocket, s_WrongPwMessage, "",
sv_rcon::response_t::SERVERDATA_RESPONSE_AUTH, static_cast<int>(eDLL_T::NETCON));
data.m_bAuthorized = false;
data.m_bValidated = false;
data.m_nFailedAttempts++;
}
}