From 4eecf9363a2a1a729a553cec2cd43d1736e9e7e8 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Sun, 25 Jan 2015 22:52:40 +0100 Subject: Client: Only decode protocol when there's actual data incoming. --- src/ClientHandle.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index a06ddd045..10920496d 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -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) { -- cgit v1.2.3