diff options
author | Cory Fields <cory-nospam-@coryfields.com> | 2015-08-20 15:50:13 -0400 |
---|---|---|
committer | Luke Dashjr <luke-jr+git@utopios.org> | 2015-09-22 00:43:14 +0000 |
commit | ccc4ad6c4d34b7f42b048f8c73dfb2d2c9dbcd99 (patch) | |
tree | bf1a6280cec86b6317b7cba8d08d361c1c4885b0 | |
parent | 1f6772e9f0aa23650f0168723fc84f247756dbc3 (diff) | |
download | bitcoin-ccc4ad6c4d34b7f42b048f8c73dfb2d2c9dbcd99.tar.xz |
net: Set SO_REUSEADDR for Windows too
When running the rpc tests in Wine, nodes often fail to listen on localhost
due to a stale socket from a previous run. This aligns the behavior with other
platforms.
-rw-r--r-- | src/net.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/net.cpp b/src/net.cpp index 99e0ca9f75..d42c28141a 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -1483,8 +1483,10 @@ bool BindListenPort(const CService &addrBind, string& strError, bool fWhiteliste setsockopt(hListenSocket, SOL_SOCKET, SO_NOSIGPIPE, (void*)&nOne, sizeof(int)); #endif // Allow binding if the port is still in TIME_WAIT state after - // the program was closed and restarted. Not an issue on windows! + // the program was closed and restarted. setsockopt(hListenSocket, SOL_SOCKET, SO_REUSEADDR, (void*)&nOne, sizeof(int)); +#else + setsockopt(hListenSocket, SOL_SOCKET, SO_REUSEADDR, (const char*)&nOne, sizeof(int)); #endif // Set to non-blocking, incoming connections will also inherit this |