| 1832 | CNetCleanup() {} |
| 1833 | |
| 1834 | ~CNetCleanup() |
| 1835 | { |
| 1836 | // Close sockets |
| 1837 | BOOST_FOREACH(CNode* pnode, vNodes) |
| 1838 | if (pnode->hSocket != INVALID_SOCKET) |
| 1839 | CloseSocket(pnode->hSocket); |
| 1840 | BOOST_FOREACH(ListenSocket& hListenSocket, vhListenSocket) |
| 1841 | if (hListenSocket.socket != INVALID_SOCKET) |
| 1842 | if (!CloseSocket(hListenSocket.socket)) |
| 1843 | LogPrintf("CloseSocket(hListenSocket) failed with error %s\n", NetworkErrorString(WSAGetLastError())); |
| 1844 | |
| 1845 | // clean up some globals (to help leak detection) |
| 1846 | BOOST_FOREACH(CNode *pnode, vNodes) |
| 1847 | delete pnode; |
| 1848 | BOOST_FOREACH(CNode *pnode, vNodesDisconnected) |
| 1849 | delete pnode; |
| 1850 | vNodes.clear(); |
| 1851 | vNodesDisconnected.clear(); |
| 1852 | vhListenSocket.clear(); |
| 1853 | delete semOutbound; |
| 1854 | semOutbound = NULL; |
| 1855 | delete pnodeLocalHost; |
| 1856 | pnodeLocalHost = NULL; |
| 1857 | |
| 1858 | #ifdef WIN32 |
| 1859 | // Shutdown Windows Sockets |
| 1860 | WSACleanup(); |
| 1861 | #endif |
| 1862 | } |
| 1863 | } |
| 1864 | instance_of_cnetcleanup; |
| 1865 |
nothing calls this directly
no test coverage detected