Network/TcpClient: Fix peer address not updated if Connect() fails

Former-commit-id: 1c8f9d5e20f6266d40233e7ad0ecf7b12fee0127
This commit is contained in:
Lynix
2015-11-12 14:54:47 +01:00
parent f28e1a7d9b
commit b77c50fe58

View File

@@ -34,8 +34,7 @@ namespace Nz
}
SocketState state = SocketImpl::Connect(m_handle, remoteAddress, &m_lastError);
if (state != SocketState_NotConnected)
m_peerAddress = remoteAddress;
m_peerAddress = (state != SocketState_NotConnected) ? remoteAddress : IpAddress::Invalid;
UpdateState(state);
return state;
@@ -109,7 +108,7 @@ namespace Nz
if (error == SocketError_NoError)
{
// No error yet, we're still connecting or connected, check that by connecting again
// No error yet, we're still connecting or connected, check that by calling Connect again
return Connect(m_peerAddress);
}
else
@@ -243,7 +242,7 @@ namespace Nz
m_peerAddress = IpAddress::Invalid;
UpdateState(newState);
return m_state == SocketState_Connected;
return newState == SocketState_Connected;
}
case SocketState_NotConnected: