aboutsummaryrefslogtreecommitdiff
path: root/util.cpp
diff options
context:
space:
mode:
authors_nakamoto <s_nakamoto@1a98c847-1fd6-4fd8-948a-caf3550aa51b>2009-11-07 05:05:03 +0000
committers_nakamoto <s_nakamoto@1a98c847-1fd6-4fd8-948a-caf3550aa51b>2009-11-07 05:05:03 +0000
commit1a01afab238cbf48331559f4be4b20f9027c53b4 (patch)
tree057c6725bb6df301d4a2b2793f14d562eb106bb0 /util.cpp
parent85c33b960211722e2183e90b2fa0460f5fe52467 (diff)
UI tweaks, use BindListenPort to detect instance already running, setsockopt(SO_REUSEADDR) so can bind during TIME_WAIT after exit and restart
Diffstat (limited to 'util.cpp')
-rw-r--r--util.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/util.cpp b/util.cpp
index 5efb579bf7..4a5b983d22 100644
--- a/util.cpp
+++ b/util.cpp
@@ -53,6 +53,17 @@ public:
for (int i = 0; i < CRYPTO_num_locks(); i++)
delete ppmutexOpenSSL[i];
OPENSSL_free(ppmutexOpenSSL);
+
+ // Close sockets
+ foreach(CNode* pnode, vNodes)
+ closesocket(pnode->hSocket);
+ if (closesocket(hListenSocket) == SOCKET_ERROR)
+ printf("closesocket(hListenSocket) failed with error %d\n", WSAGetLastError());
+
+#ifdef __WXMSW__
+ // Shutdown Windows Sockets
+ WSACleanup();
+#endif
}
}
instance_of_cinit;