diff options
author | Pierre Ossman <ossman@cendio.se> | 2015-04-23 11:30:59 +0200 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2015-04-23 11:30:59 +0200 |
commit | 056c153209fea793ce00986cf102a5b587e28369 (patch) | |
tree | a2bc025e3903ff83f7ad244208f2174e6b669512 /common/network | |
parent | b6536e250a7ce5cd3a4d7415f3dbc79e18b71e53 (diff) | |
download | tigervnc-056c153209fea793ce00986cf102a5b587e28369.tar.gz tigervnc-056c153209fea793ce00986cf102a5b587e28369.zip |
Clarify Windows SO_REUSEADDR exception
Diffstat (limited to 'common/network')
-rw-r--r-- | common/network/TcpSocket.cxx | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/common/network/TcpSocket.cxx b/common/network/TcpSocket.cxx index 99895ad8..1ebaeecb 100644 --- a/common/network/TcpSocket.cxx +++ b/common/network/TcpSocket.cxx @@ -440,10 +440,15 @@ TcpListener::TcpListener(const struct sockaddr *listenaddr, } #endif /* defined(IPV6_V6ONLY) */ -#ifndef WIN32 +#ifdef FD_CLOEXEC // - By default, close the socket on exec() fcntl(sock, F_SETFD, FD_CLOEXEC); +#endif + // SO_REUSEADDR is broken on Windows. It allows binding to a port + // that already has a listening socket on it. SO_EXCLUSIVEADDRUSE + // might do what we want, but requires investigation. +#ifndef WIN32 if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char *)&one, sizeof(one)) < 0) { int e = errorNumber; |