MCPcopy Create free account
hub / github.com/LUX-Core/lux / ~CNetCleanup

Method ~CNetCleanup

src/net.cpp:2006–2034  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2004 CNetCleanup() {}
2005
2006 ~CNetCleanup()
2007 {
2008 // Close sockets
2009 for (CNode* pnode : vNodes)
2010 if (pnode->hSocket != INVALID_SOCKET)
2011 CloseSocket(pnode->hSocket);
2012 for (ListenSocket& hListenSocket : vhListenSocket)
2013 if (hListenSocket.socket != INVALID_SOCKET)
2014 if (!CloseSocket(hListenSocket.socket))
2015 LogPrintf("CloseSocket(hListenSocket) failed with error %s\n", NetworkErrorString(WSAGetLastError()));
2016
2017 // clean up some globals (to help leak detection)
2018 for (CNode* pnode : vNodes)
2019 delete pnode;
2020 for (CNode* pnode : vNodesDisconnected)
2021 delete pnode;
2022 vNodes.clear();
2023 vNodesDisconnected.clear();
2024 vhListenSocket.clear();
2025 delete semOutbound;
2026 semOutbound = NULL;
2027 delete pnodeLocalHost;
2028 pnodeLocalHost = NULL;
2029
2030#ifdef WIN32
2031 // Shutdown Windows Sockets
2032 WSACleanup();
2033#endif
2034 }
2035} instance_of_cnetcleanup;
2036
2037void CExplicitNetCleanup::callCleanup() {

Callers

nothing calls this directly

Calls 3

CloseSocketFunction · 0.85
NetworkErrorStringFunction · 0.85
clearMethod · 0.45

Tested by

no test coverage detected