mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 10:41:50 +00:00
Workaround broken connect implementation.
This commit is contained in:
parent
5ccd62ced8
commit
f7727f3aa4
@ -113,7 +113,8 @@ 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;
|
||||||
@ -125,14 +126,16 @@ bool Socket::Connect( const char* addr, int port )
|
|||||||
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 );
|
freeaddrinfo( m_res );
|
||||||
close( m_connSock );
|
close( m_connSock );
|
||||||
m_ptr = nullptr;
|
m_ptr = nullptr;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined _WIN32 || defined __CYGWIN__
|
#if defined _WIN32 || defined __CYGWIN__
|
||||||
|
Loading…
Reference in New Issue
Block a user