1
0

Client: Only decode protocol when there's actual data incoming.

This commit is contained in:
Mattes D 2015-01-25 22:52:40 +01:00
parent b3437c5b01
commit 4eecf9363a

View File

@ -1884,7 +1884,10 @@ void cClientHandle::Tick(float a_Dt)
cCSLock Lock(m_CSIncomingData);
std::swap(IncomingData, m_IncomingData);
}
m_Protocol->DataReceived(IncomingData.data(), IncomingData.size());
if (!IncomingData.empty())
{
m_Protocol->DataReceived(IncomingData.data(), IncomingData.size());
}
m_TicksSinceLastPacket += 1;
if (m_TicksSinceLastPacket > 600) // 30 seconds time-out
@ -1968,7 +1971,10 @@ void cClientHandle::ServerTick(float a_Dt)
cCSLock Lock(m_CSIncomingData);
std::swap(IncomingData, m_IncomingData);
}
m_Protocol->DataReceived(IncomingData.data(), IncomingData.size());
if (!IncomingData.empty())
{
m_Protocol->DataReceived(IncomingData.data(), IncomingData.size());
}
if (m_State == csAuthenticated)
{