Network/TcpClient: Fix error when receiving an empty packet
Former-commit-id: 653a77b0b059968600777e89c02144d8a3e55cf3 [formerly 338bed3ccd44ad4a683e90cd1b99598660c47048] [formerly 8136c65b123704f0243edd20558ea19d636d2127 [formerly 4c158ec5ee63b97c1d9a828f4088a2f1908f3a32]] Former-commit-id: b8491dc53c5792acadb2f9f6479e9aaec472ae05 [formerly 79127a86db6256fc749591c59663fbe7cbaddc37] Former-commit-id: 2621271910cefb53cfd612cd8246af2e10ef4bd8
This commit is contained in:
parent
c1e1d35028
commit
19a6eee044
|
|
@ -262,6 +262,17 @@ namespace Nz
|
|||
if (m_pendingPacket.headerReceived)
|
||||
{
|
||||
UInt16 packetSize = static_cast<UInt16>(m_pendingPacket.data.GetSize()); //< Total packet size
|
||||
if (packetSize == 0)
|
||||
{
|
||||
// Special case: our packet carry no data
|
||||
packet->Reset(packetSize);
|
||||
|
||||
// And reset every state
|
||||
m_pendingPacket.data.Clear();
|
||||
m_pendingPacket.headerReceived = false;
|
||||
m_pendingPacket.received = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
std::size_t received;
|
||||
if (!Receive(&m_pendingPacket.data[m_pendingPacket.received], packetSize - m_pendingPacket.received, &received))
|
||||
|
|
|
|||
Loading…
Reference in New Issue