MCPcopy Create free account
hub / github.com/WaykiChain/WaykiChain / ~CNetCleanup

Method ~CNetCleanup

src/net.cpp:1442–1469  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1440public:
1441 CNetCleanup() {}
1442 ~CNetCleanup() {
1443 // Close sockets
1444 for (auto pNode : vNodes)
1445 if (pNode->hSocket != INVALID_SOCKET)
1446 closesocket(pNode->hSocket);
1447 for (auto hListenSocket : vhListenSocket)
1448 if (hListenSocket != INVALID_SOCKET)
1449 if (closesocket(hListenSocket) == SOCKET_ERROR)
1450 LogPrint(BCLog::INFO, "closesocket(hListenSocket) failed with error %s\n",
1451 NetworkErrorString(WSAGetLastError()));
1452
1453 // clean up some globals (to help leak detection)
1454 for (auto pNode : vNodes)
1455 delete pNode;
1456 for (auto pNode : vNodesDisconnected)
1457 delete pNode;
1458 vNodes.clear();
1459 vNodesDisconnected.clear();
1460 delete semOutbound;
1461 semOutbound = nullptr;
1462 delete pnodeLocalHost;
1463 pnodeLocalHost = nullptr;
1464
1465#ifdef WIN32
1466 // Shutdown Windows Sockets
1467 WSACleanup();
1468#endif
1469 }
1470}
1471
1472instance_of_cnetcleanup;

Callers

nothing calls this directly

Calls 2

NetworkErrorStringFunction · 0.85
clearMethod · 0.45

Tested by

no test coverage detected