diff --git a/common/TracySocket.cpp b/common/TracySocket.cpp index 65874d43..04a07525 100644 --- a/common/TracySocket.cpp +++ b/common/TracySocket.cpp @@ -113,25 +113,28 @@ bool Socket::Connect( const char* addr, int port ) if( m_ptr ) { 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__ - const auto err = WSAGetLastError(); - if( err == WSAEALREADY || err == WSAEINPROGRESS ) return false; - if( err != WSAEISCONN ) - { - freeaddrinfo( m_res ); - closesocket( m_connSock ); - m_ptr = nullptr; - return false; - } + const auto err = WSAGetLastError(); + if( err == WSAEALREADY || err == WSAEINPROGRESS ) return false; + if( err != WSAEISCONN ) + { + freeaddrinfo( m_res ); + closesocket( m_connSock ); + m_ptr = nullptr; + return false; + } #else - if( errno == EALREADY || errno == EINPROGRESS ) return false; - if( errno != EISCONN ) - { - freeaddrinfo( m_res ); - close( m_connSock ); - m_ptr = nullptr; - return false; + const auto err = errno; + if( err == EALREADY || err == EINPROGRESS ) return false; + if( err != EISCONN ) + { + freeaddrinfo( m_res ); + close( m_connSock ); + m_ptr = nullptr; + return false; + } } #endif