Don't try to set socket options on invalid socket.

This commit is contained in:
Bartosz Taudul 2019-04-01 20:08:27 +02:00
parent 8d0d6b576a
commit 687915299a

View File

@ -315,20 +315,16 @@ Socket* ListenSocket::Accept()
if( poll( &fd, 1, 10 ) > 0 )
{
int sock = accept( m_sock, (sockaddr*)&remote, &sz);
if( sock == -1 ) return nullptr;
#if defined __APPLE__
int val = 1;
setsockopt( sock, SOL_SOCKET, SO_NOSIGPIPE, &val, sizeof( val ) );
#endif
if( sock == -1 )
{
return nullptr;
}
else
{
auto ptr = (Socket*)tracy_malloc( sizeof( Socket ) );
new(ptr) Socket( sock );
return ptr;
}
auto ptr = (Socket*)tracy_malloc( sizeof( Socket ) );
new(ptr) Socket( sock );
return ptr;
}
else
{