diff options
author | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2021-04-12 14:54:58 +0300 |
---|---|---|
committer | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2021-04-22 17:28:39 +0300 |
commit | a3d090d1103cd6c25daf07afdf4e65febca6d3f7 (patch) | |
tree | d56437fabbfdda126e24aa011dda36710d476250 /src/init.cpp | |
parent | f0b457212f9876a8c7e4d680178b49b555b488e2 (diff) |
net: Restrict period when cs_vNodes mutex is locked
Diffstat (limited to 'src/init.cpp')
-rw-r--r-- | src/init.cpp | 15 |
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(); |