mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-27 00:04:35 +00:00
Don't try to set socket options on invalid socket.
This commit is contained in:
parent
8d0d6b576a
commit
687915299a
@ -315,20 +315,16 @@ Socket* ListenSocket::Accept()
|
|||||||
if( poll( &fd, 1, 10 ) > 0 )
|
if( poll( &fd, 1, 10 ) > 0 )
|
||||||
{
|
{
|
||||||
int sock = accept( m_sock, (sockaddr*)&remote, &sz);
|
int sock = accept( m_sock, (sockaddr*)&remote, &sz);
|
||||||
|
if( sock == -1 ) return nullptr;
|
||||||
|
|
||||||
#if defined __APPLE__
|
#if defined __APPLE__
|
||||||
int val = 1;
|
int val = 1;
|
||||||
setsockopt( sock, SOL_SOCKET, SO_NOSIGPIPE, &val, sizeof( val ) );
|
setsockopt( sock, SOL_SOCKET, SO_NOSIGPIPE, &val, sizeof( val ) );
|
||||||
#endif
|
#endif
|
||||||
if( sock == -1 )
|
|
||||||
{
|
auto ptr = (Socket*)tracy_malloc( sizeof( Socket ) );
|
||||||
return nullptr;
|
new(ptr) Socket( sock );
|
||||||
}
|
return ptr;
|
||||||
else
|
|
||||||
{
|
|
||||||
auto ptr = (Socket*)tracy_malloc( sizeof( Socket ) );
|
|
||||||
new(ptr) Socket( sock );
|
|
||||||
return ptr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user