Network/UdpSocket: Fix UdpSocket::Receive failing when peers suddenly closes its socket
This commit is contained in:
parent
d8b7ff9fa6
commit
3489421064
|
|
@ -93,7 +93,18 @@ namespace Nz
|
||||||
|
|
||||||
int read;
|
int read;
|
||||||
if (!SocketImpl::ReceiveFrom(m_handle, buffer, static_cast<int>(size), from, &read, &m_lastError))
|
if (!SocketImpl::ReceiveFrom(m_handle, buffer, static_cast<int>(size), from, &read, &m_lastError))
|
||||||
|
{
|
||||||
|
switch (m_lastError)
|
||||||
|
{
|
||||||
|
case SocketError_ConnectionClosed:
|
||||||
|
m_lastError = SocketError_NoError;
|
||||||
|
read = 0;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (received)
|
if (received)
|
||||||
*received = read;
|
*received = read;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue