mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 02:31:48 +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__
|
||||
unsigned long val = 0;
|
||||
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
|
||||
if( bind( m_sock, res->ai_addr, res->ai_addrlen ) == -1 ) return false;
|
||||
if( listen( m_sock, backlog ) == -1 ) return false;
|
||||
|
Loading…
Reference in New Issue
Block a user