File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -177,7 +177,18 @@ class CConnman
177
177
CConnman (uint64_t seed0, uint64_t seed1);
178
178
~CConnman ();
179
179
bool Start (CScheduler& scheduler, const Options& options);
180
- void Stop ();
180
+
181
+ // TODO: Remove NO_THREAD_SAFETY_ANALYSIS. Lock cs_vNodes before reading the variable vNodes.
182
+ //
183
+ // When removing NO_THREAD_SAFETY_ANALYSIS be aware of the following lock order requirements:
184
+ // * CheckForStaleTipAndEvictPeers locks cs_main before indirectly calling GetExtraOutboundCount
185
+ // which locks cs_vNodes.
186
+ // * ProcessMessage locks cs_main and g_cs_orphans before indirectly calling ForEachNode which
187
+ // locks cs_vNodes.
188
+ //
189
+ // Thus the implicit locking order requirement is: (1) cs_main, (2) g_cs_orphans, (3) cs_vNodes.
190
+ void Stop () NO_THREAD_SAFETY_ANALYSIS;
191
+
181
192
void Interrupt ();
182
193
bool GetNetworkActive () const { return fNetworkActive ; };
183
194
bool GetUseAddrmanOutgoing () const { return m_use_addrman_outgoing; };
@@ -418,7 +429,7 @@ class CConnman
418
429
CCriticalSection cs_vOneShots;
419
430
std::vector<std::string> vAddedNodes GUARDED_BY (cs_vAddedNodes);
420
431
CCriticalSection cs_vAddedNodes;
421
- std::vector<CNode*> vNodes;
432
+ std::vector<CNode*> vNodes GUARDED_BY (cs_vNodes) ;
422
433
std::list<CNode*> vNodesDisconnected;
423
434
mutable CCriticalSection cs_vNodes;
424
435
std::atomic<NodeId> nLastNodeId{0 };
You can’t perform that action at this time.
0 commit comments