aboutsummaryrefslogtreecommitdiff
path: root/net.cpp
diff options
context:
space:
mode:
authors_nakamoto <s_nakamoto@1a98c847-1fd6-4fd8-948a-caf3550aa51b>2009-12-11 16:49:21 +0000
committers_nakamoto <s_nakamoto@1a98c847-1fd6-4fd8-948a-caf3550aa51b>2009-12-11 16:49:21 +0000
commit4ea3f3da1a0c00ea74e85c31a22ea94d18bbdf06 (patch)
tree4f9bb0b8598035b704a8abe08a292e8465e7c1c6 /net.cpp
parentb075bbf9862df41cdf5265026ba787b7d0fecb07 (diff)
retry IRC if name in use,
resize to fit ubuntu's giant default font, scroll debug.log, pause gen during initial block download git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@44 1a98c847-1fd6-4fd8-948a-caf3550aa51b
Diffstat (limited to 'net.cpp')
-rw-r--r--net.cpp25
1 files changed, 24 insertions, 1 deletions
diff --git a/net.cpp b/net.cpp
index 9f4060b9da..436a5abf7b 100644
--- a/net.cpp
+++ b/net.cpp
@@ -21,7 +21,6 @@ uint64 nLocalServices = (fClient ? 0 : NODE_NETWORK);
CAddress addrLocalHost(0, DEFAULT_PORT, nLocalServices);
CNode* pnodeLocalHost = NULL;
uint64 nLocalHostNonce = 0;
-bool fShutdown = false;
array<int, 10> vnThreadsRunning;
SOCKET hListenSocket = INVALID_SOCKET;
int64 nThreadSocketHandlerHeartbeat = INT64_MAX;
@@ -1324,3 +1323,27 @@ bool StopNode()
return true;
}
+
+class CNetCleanup
+{
+public:
+ CNetCleanup()
+ {
+ }
+ ~CNetCleanup()
+ {
+ // Close sockets
+ foreach(CNode* pnode, vNodes)
+ if (pnode->hSocket != INVALID_SOCKET)
+ closesocket(pnode->hSocket);
+ if (hListenSocket != INVALID_SOCKET)
+ if (closesocket(hListenSocket) == SOCKET_ERROR)
+ printf("closesocket(hListenSocket) failed with error %d\n", WSAGetLastError());
+
+#ifdef __WXMSW__
+ // Shutdown Windows Sockets
+ WSACleanup();
+#endif
+ }
+}
+instance_of_cnetcleanup;