Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14864481
D5690.id18729.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
D5690.id18729.diff
View Options
diff --git a/src/net.h b/src/net.h
--- a/src/net.h
+++ b/src/net.h
@@ -173,7 +173,21 @@
~CConnman();
bool Start(CScheduler &scheduler, const Options &options);
- void Stop();
+
+ // TODO: Remove NO_THREAD_SAFETY_ANALYSIS. Lock cs_vNodes before reading the
+ // variable vNodes.
+ //
+ // When removing NO_THREAD_SAFETY_ANALYSIS be aware of the following lock
+ // order requirements:
+ // * CheckForStaleTipAndEvictPeers locks cs_main before indirectly calling
+ // GetExtraOutboundCount which locks cs_vNodes.
+ // * ProcessMessage locks cs_main and g_cs_orphans before indirectly calling
+ // ForEachNode which locks cs_vNodes.
+ //
+ // Thus the implicit locking order requirement is: (1) cs_main, (2)
+ // g_cs_orphans, (3) cs_vNodes.
+ void Stop() NO_THREAD_SAFETY_ANALYSIS;
+
void Interrupt();
bool GetNetworkActive() const { return fNetworkActive; };
void SetNetworkActive(bool active);
@@ -386,7 +400,7 @@
CCriticalSection cs_vOneShots;
std::vector<std::string> vAddedNodes GUARDED_BY(cs_vAddedNodes);
CCriticalSection cs_vAddedNodes;
- std::vector<CNode *> vNodes;
+ std::vector<CNode *> vNodes GUARDED_BY(cs_vNodes);
std::list<CNode *> vNodesDisconnected;
mutable CCriticalSection cs_vNodes;
std::atomic<NodeId> nLastNodeId{0};
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, May 20, 20:00 (9 h, 5 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5864716
Default Alt Text
D5690.id18729.diff (1 KB)
Attached To
D5690: Merge #15201: net: Add missing locking annotation for vNodes. vNodes is guarded by cs_vNodes.
Event Timeline
Log In to Comment