aboutsummaryrefslogtreecommitdiff
path: root/src/init.cpp
diff options
context:
space:
mode:
authorHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2021-04-12 14:54:58 +0300
committerHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2021-04-22 17:28:39 +0300
commita3d090d1103cd6c25daf07afdf4e65febca6d3f7 (patch)
treed56437fabbfdda126e24aa011dda36710d476250 /src/init.cpp
parentf0b457212f9876a8c7e4d680178b49b555b488e2 (diff)
downloadbitcoin-a3d090d1103cd6c25daf07afdf4e65febca6d3f7.tar.xz
net: Restrict period when cs_vNodes mutex is locked
Diffstat (limited to 'src/init.cpp')
-rw-r--r--src/init.cpp15
1 files changed, 1 insertions, 14 deletions
diff --git a/src/init.cpp b/src/init.cpp
index 701a7529af..280a0cbda7 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -200,20 +200,7 @@ void Shutdown(NodeContext& node)
// Because these depend on each-other, we make sure that neither can be
// using the other before destroying them.
if (node.peerman) UnregisterValidationInterface(node.peerman.get());
- // Follow the lock order requirements:
- // * CheckForStaleTipAndEvictPeers locks cs_main before indirectly calling GetExtraFullOutboundCount
- // which locks cs_vNodes.
- // * ProcessMessage locks cs_main and g_cs_orphans before indirectly calling ForEachNode which
- // locks cs_vNodes.
- // * CConnman::Stop calls DeleteNode, which calls FinalizeNode, which locks cs_main and calls
- // EraseOrphansFor, which locks g_cs_orphans.
- //
- // Thus the implicit locking order requirement is: (1) cs_main, (2) g_cs_orphans, (3) cs_vNodes.
- if (node.connman) {
- node.connman->StopThreads();
- LOCK2(::cs_main, ::g_cs_orphans);
- node.connman->StopNodes();
- }
+ if (node.connman) node.connman->Stop();
StopTorControl();