diff options
author | Gavin Andresen <gavinandresen@gmail.com> | 2013-04-02 10:00:31 -0700 |
---|---|---|
committer | Gavin Andresen <gavinandresen@gmail.com> | 2013-04-02 10:00:31 -0700 |
commit | d8aae1ce1deea764f9ab61bbd210a3963f650d96 (patch) | |
tree | 0a7fa2798875db0c2914186696dcae903051f429 /src/net.cpp | |
parent | 06db61f09e4201a17ef169754ac374a2b7a37316 (diff) | |
parent | 3427517d507a938074a50fa8ea6dfe3d13bef357 (diff) |
Merge pull request #2420 from sipa/globclean
Global cleanups
Diffstat (limited to 'src/net.cpp')
-rw-r--r-- | src/net.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/net.cpp b/src/net.cpp index 6f3c8a51ae..669f44b639 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -775,12 +775,12 @@ void ThreadSocketHandler(void* parg) printf("ThreadSocketHandler exited\n"); } +static list<CNode*> vNodesDisconnected; + void ThreadSocketHandler2(void* parg) { printf("ThreadSocketHandler started\n"); - list<CNode*> vNodesDisconnected; unsigned int nPrevNodeCount = 0; - loop { // @@ -2085,6 +2085,7 @@ bool StopNode() Sleep(20); Sleep(50); DumpAddresses(); + return true; } @@ -2105,6 +2106,18 @@ public: if (closesocket(hListenSocket) == SOCKET_ERROR) printf("closesocket(hListenSocket) failed with error %d\n", WSAGetLastError()); + // clean up some globals (to help leak detection) + BOOST_FOREACH(CNode *pnode, vNodes) + delete pnode; + BOOST_FOREACH(CNode *pnode, vNodesDisconnected) + delete pnode; + vNodes.clear(); + vNodesDisconnected.clear(); + delete semOutbound; + semOutbound = NULL; + delete pnodeLocalHost; + pnodeLocalHost = NULL; + #ifdef WIN32 // Shutdown Windows Sockets WSACleanup(); |