1
0
mirror of https://github.com/wolfpld/tracy synced 2025-04-29 12:23:53 +00:00

Workaround broken connect implementation.

This commit is contained in:
Bartosz Taudul 2020-06-20 18:35:21 +02:00
parent 5ccd62ced8
commit f7727f3aa4

View File

@ -113,25 +113,28 @@ bool Socket::Connect( const char* addr, int port )
if( m_ptr ) if( m_ptr )
{ {
const auto c = connect( m_connSock, m_ptr->ai_addr, m_ptr->ai_addrlen ); const auto c = connect( m_connSock, m_ptr->ai_addr, m_ptr->ai_addrlen );
assert( c == -1 ); if( c == -1 )
{
#if defined _WIN32 || defined __CYGWIN__ #if defined _WIN32 || defined __CYGWIN__
const auto err = WSAGetLastError(); const auto err = WSAGetLastError();
if( err == WSAEALREADY || err == WSAEINPROGRESS ) return false; if( err == WSAEALREADY || err == WSAEINPROGRESS ) return false;
if( err != WSAEISCONN ) if( err != WSAEISCONN )
{ {
freeaddrinfo( m_res ); freeaddrinfo( m_res );
closesocket( m_connSock ); closesocket( m_connSock );
m_ptr = nullptr; m_ptr = nullptr;
return false; return false;
} }
#else #else
if( errno == EALREADY || errno == EINPROGRESS ) return false; const auto err = errno;
if( errno != EISCONN ) if( err == EALREADY || err == EINPROGRESS ) return false;
{ if( err != EISCONN )
freeaddrinfo( m_res ); {
close( m_connSock ); freeaddrinfo( m_res );
m_ptr = nullptr; close( m_connSock );
return false; m_ptr = nullptr;
return false;
}
} }
#endif #endif