MCPcopy Create free account
hub / github.com/ElementsProject/elements / StopNodes

Method StopNodes

src/net.cpp:2742–2773  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2740}
2741
2742void CConnman::StopNodes()
2743{
2744 if (fAddressesInitialized) {
2745 DumpAddresses();
2746 fAddressesInitialized = false;
2747
2748 if (m_use_addrman_outgoing) {
2749 // Anchor connections are only dumped during clean shutdown.
2750 std::vector<CAddress> anchors_to_dump = GetCurrentBlockRelayOnlyConns();
2751 if (anchors_to_dump.size() > MAX_BLOCK_RELAY_ONLY_ANCHORS) {
2752 anchors_to_dump.resize(MAX_BLOCK_RELAY_ONLY_ANCHORS);
2753 }
2754 DumpAnchors(gArgs.GetDataDirNet() / ANCHORS_DATABASE_FILENAME, anchors_to_dump);
2755 }
2756 }
2757
2758 // Delete peer connections.
2759 std::vector<CNode*> nodes;
2760 WITH_LOCK(m_nodes_mutex, nodes.swap(m_nodes));
2761 for (CNode* pnode : nodes) {
2762 pnode->CloseSocketDisconnect();
2763 DeleteNode(pnode);
2764 }
2765
2766 for (CNode* pnode : m_nodes_disconnected) {
2767 DeleteNode(pnode);
2768 }
2769 m_nodes_disconnected.clear();
2770 vhListenSocket.clear();
2771 semOutbound.reset();
2772 semAddnode.reset();
2773}
2774
2775void CConnman::DeleteNode(CNode* pnode)
2776{

Callers 2

fuzz_targetFunction · 0.80
FUZZ_TARGET_INITFunction · 0.80

Calls 7

DumpAnchorsFunction · 0.85
CloseSocketDisconnectMethod · 0.80
sizeMethod · 0.45
resizeMethod · 0.45
swapMethod · 0.45
clearMethod · 0.45
resetMethod · 0.45

Tested by 2

fuzz_targetFunction · 0.64
FUZZ_TARGET_INITFunction · 0.64