Network/TcpClient: WaitForConnected now closes the socket on failure

This commit is contained in:
Lynix 2018-10-01 22:19:49 +02:00
parent f6b0405f9b
commit 13a515c1b5
2 changed files with 3 additions and 2 deletions

View File

@ -147,6 +147,7 @@ Nazara Engine:
- ⚠️ CullingList now handles full and partial visibility testing - ⚠️ CullingList now handles full and partial visibility testing
- Added math class Angle, capable of handling both degrees and radians angles and converting them to euler angles/quaternions to improve 2D interface. - Added math class Angle, capable of handling both degrees and radians angles and converting them to euler angles/quaternions to improve 2D interface.
- ⚠️ AbstractSocket::OnStateChange has been replaced by OnStateChanged, which is now called after state has been changed (with oldState and newState as parameters). - ⚠️ AbstractSocket::OnStateChange has been replaced by OnStateChanged, which is now called after state has been changed (with oldState and newState as parameters).
- ⚠️ TcpClient::WaitForconnected now closes the socket on failure.
Nazara Development Kit: Nazara Development Kit:
- Added ImageWidget (#139) - Added ImageWidget (#139)

View File

@ -467,9 +467,9 @@ namespace Nz
SocketState newState = SocketImpl::Connect(m_handle, m_peerAddress, msTimeout, &m_lastError); SocketState newState = SocketImpl::Connect(m_handle, m_peerAddress, msTimeout, &m_lastError);
NazaraAssert(newState != SocketState_Connecting, "Invalid internal return"); //< Connect cannot return Connecting is a timeout was specified NazaraAssert(newState != SocketState_Connecting, "Invalid internal return"); //< Connect cannot return Connecting is a timeout was specified
// Prevent valid peer address in non-connected state // Prevent valid stats in non-connected state
if (newState == SocketState_NotConnected) if (newState == SocketState_NotConnected)
m_peerAddress = IpAddress::Invalid; Close();
UpdateState(newState); UpdateState(newState);
return newState == SocketState_Connected; return newState == SocketState_Connected;