aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCory Fields <cory-nospam-@coryfields.com>2015-08-20 15:50:13 -0400
committerCory Fields <cory-nospam-@coryfields.com>2015-08-25 11:31:06 -0400
commita19338723d662e6fc0571833d2b9983e1914f282 (patch)
tree358a868251aad1bb1031283953e151d24b5146dc
parentda9beb288d2ee35b9c70513dd18f220b2dc32f16 (diff)
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.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/net.cpp b/src/net.cpp
index fb5726a2b9..8fda5140ca 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -1625,8 +1625,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