mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Engine: fix regression in message processor
Old regression that was caused by implementing the ability to disconnect the socket from anywhere in the rcon code, but it was never accounted for in CNetConBase::ProcessBuffer() and CNetConBase::Recv(). ProcessBuffer() must return directly when ProcessMessage() failed, and Recv() must break out if ProcessBuffer() returned false.
This commit is contained in:
parent
b1d81e2dc5
commit
f491f3dfe3
@ -147,7 +147,6 @@ bool CNetConBase::Connect(const char* pHostName, const int nPort)
|
||||
bool CNetConBase::ProcessBuffer(CConnectedNetConsoleData& data,
|
||||
const char* pRecvBuf, int nRecvLen, const int nMaxLen)
|
||||
{
|
||||
bool bSuccess = true;
|
||||
byte prefix[sizeof(u_long)] = {};
|
||||
|
||||
while (nRecvLen > 0)
|
||||
@ -164,10 +163,9 @@ bool CNetConBase::ProcessBuffer(CConnectedNetConsoleData& data,
|
||||
if (data.m_nPayloadRead == data.m_nPayloadLen)
|
||||
{
|
||||
if (!ProcessMessage(
|
||||
reinterpret_cast<const char*>(data.m_RecvBuffer.data()), data.m_nPayloadLen)
|
||||
&& bSuccess)
|
||||
reinterpret_cast<const char*>(data.m_RecvBuffer.data()), data.m_nPayloadLen))
|
||||
{
|
||||
bSuccess = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
data.m_nPayloadLen = 0;
|
||||
@ -214,7 +212,7 @@ bool CNetConBase::ProcessBuffer(CConnectedNetConsoleData& data,
|
||||
}
|
||||
}
|
||||
|
||||
return bSuccess;
|
||||
return true;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -342,7 +340,9 @@ void CNetConBase::Recv(CConnectedNetConsoleData& data, const int nMaxLen)
|
||||
}
|
||||
|
||||
nReadLen -= nRecvLen; // Process what we've got.
|
||||
ProcessBuffer(data, szRecvBuf, nRecvLen, nMaxLen);
|
||||
|
||||
if (!ProcessBuffer(data, szRecvBuf, nRecvLen, nMaxLen))
|
||||
break;
|
||||
}
|
||||
|
||||
return;
|
||||
|
Loading…
x
Reference in New Issue
Block a user