mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Fix crash during init
If an error occurs during init, and 'Error' is called, the program will segfault. Fixed by only running the 'send' code from RCON after it has been initialized.
This commit is contained in:
parent
14aff2d7b7
commit
0dace8eea3
@ -81,7 +81,7 @@ void CRConServer::Think(void)
|
||||
for (m_nConnIndex = nCount - 1; m_nConnIndex >= 0; m_nConnIndex--)
|
||||
{
|
||||
const netadr_t& netAdr = m_Socket.GetAcceptedSocketAddress(m_nConnIndex);
|
||||
if (strcmp(netAdr.ToString(true), sv_rcon_whitelist_address->GetString()) != 0) // TODO: doesn't work
|
||||
if (strcmp(netAdr.ToString(true), sv_rcon_whitelist_address->GetString()) != 0)
|
||||
{
|
||||
const CConnectedNetConsoleData* pData = m_Socket.GetAcceptedSocketData(m_nConnIndex);
|
||||
if (!pData->m_bAuthorized)
|
||||
@ -195,6 +195,11 @@ void CRConServer::Send(const SocketHandle_t hSocket, const std::string& svMessag
|
||||
//-----------------------------------------------------------------------------
|
||||
void CRConServer::Send(const std::string& svRspBuf, const std::string& svRspVal, const sv_rcon::response_t responseType, const int nResponseId)
|
||||
{
|
||||
if (!m_bInitialized)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (responseType == sv_rcon::response_t::SERVERDATA_RESPONSE_CONSOLE_LOG)
|
||||
{
|
||||
if (!sv_rcon_sendlogs->GetBool())
|
||||
@ -215,6 +220,11 @@ void CRConServer::Send(const std::string& svRspBuf, const std::string& svRspVal,
|
||||
//-----------------------------------------------------------------------------
|
||||
void CRConServer::Send(const SocketHandle_t hSocket, const std::string& svRspBuf, const std::string& svRspVal, const sv_rcon::response_t responseType, const int nResponseId)
|
||||
{
|
||||
if (!m_bInitialized)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (responseType == sv_rcon::response_t::SERVERDATA_RESPONSE_CONSOLE_LOG)
|
||||
{
|
||||
if (!sv_rcon_sendlogs->GetBool())
|
||||
|
@ -22,8 +22,6 @@ public:
|
||||
void Think(void);
|
||||
void RunFrame(void);
|
||||
|
||||
void Send(const std::string& svMessage) const;
|
||||
void Send(const SocketHandle_t hSocket, const std::string& svMessage) const;
|
||||
void Send(const std::string& svRspBuf, const std::string& svRspVal, const sv_rcon::response_t responseType, const int nResponseId = -4);
|
||||
void Send(const SocketHandle_t hSocket, const std::string& svRspBuf, const std::string& svRspVal, const sv_rcon::response_t responseType, const int nResponseId = -4);
|
||||
void Recv(void);
|
||||
@ -46,6 +44,8 @@ public:
|
||||
bool IsInitialized(void) const;
|
||||
|
||||
private:
|
||||
void Send(const std::string& svMessage) const;
|
||||
void Send(const SocketHandle_t hSocket, const std::string& svMessage) const;
|
||||
|
||||
bool m_bInitialized;
|
||||
int m_nConnIndex;
|
||||
|
Loading…
x
Reference in New Issue
Block a user