mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-30 01:04:36 +00:00
Prevent TIME-WAIT connections from blocking listen address.
Of course Windows has to be retarded in its own special way and implement SO_REUSEADDR with a completely different meaning. http://www.andy-pearce.com/blog/posts/2013/Feb/so_reuseaddr-on-windows/
This commit is contained in:
parent
237aee30a8
commit
eeeff40a70
@ -228,6 +228,9 @@ bool ListenSocket::Listen( const char* port, int backlog )
|
|||||||
#if defined _MSC_VER || defined __CYGWIN__
|
#if defined _MSC_VER || defined __CYGWIN__
|
||||||
unsigned long val = 0;
|
unsigned long val = 0;
|
||||||
setsockopt( m_sock, IPPROTO_IPV6, IPV6_V6ONLY, (const char*)&val, sizeof( val ) );
|
setsockopt( m_sock, IPPROTO_IPV6, IPV6_V6ONLY, (const char*)&val, sizeof( val ) );
|
||||||
|
#else
|
||||||
|
int val = 1;
|
||||||
|
setsockopt( m_sock, SOL_SOCKET, SO_REUSEADDR, &val, sizeof( val ) );
|
||||||
#endif
|
#endif
|
||||||
if( bind( m_sock, res->ai_addr, res->ai_addrlen ) == -1 ) return false;
|
if( bind( m_sock, res->ai_addr, res->ai_addrlen ) == -1 ) return false;
|
||||||
if( listen( m_sock, backlog ) == -1 ) return false;
|
if( listen( m_sock, backlog ) == -1 ) return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user