aboutsummaryrefslogtreecommitdiff
path: root/src/net_processing.h
diff options
context:
space:
mode:
authorJohn Newbery <john@johnnewbery.com>2020-08-28 21:04:44 +0100
committerJohn Newbery <john@johnnewbery.com>2020-12-19 14:49:03 +0000
commit717a374e74b64b7b90bc1b2995e8900212bd0bfe (patch)
tree98a0e5025ea11a829f10b17475a789aaaba76be6 /src/net_processing.h
parentf1dbf92ff0475a01d20170ea422c1d086acbbc57 (diff)
downloadbitcoin-717a374e74b64b7b90bc1b2995e8900212bd0bfe.tar.xz
[net processing] Improve documentation for Peer destruction/locking
Suggested here: - https://github.com/bitcoin/bitcoin/pull/19607#discussion_r467071878 - https://github.com/bitcoin/bitcoin/pull/19829#discussion_r546116786
Diffstat (limited to 'src/net_processing.h')
-rw-r--r--src/net_processing.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/net_processing.h b/src/net_processing.h
index 12a4e9c38f..3600fe7d63 100644
--- a/src/net_processing.h
+++ b/src/net_processing.h
@@ -46,6 +46,8 @@ struct CNodeStateStats {
* Memory is owned by shared pointers and this object is destructed when
* the refcount drops to zero.
*
+ * Mutexes inside this struct must not be held when locking m_peer_mutex.
+ *
* TODO: move most members from CNodeState to this structure.
* TODO: move remaining application-layer data members from CNode to this structure.
*/
@@ -210,7 +212,8 @@ private:
* on extra block-relay-only peers. */
bool m_initial_sync_finished{false};
- /** Protects m_peer_map */
+ /** Protects m_peer_map. This mutex must not be locked while holding a lock
+ * on any of the mutexes inside a Peer object. */
mutable Mutex m_peer_mutex;
/**
* Map of all Peer objects, keyed by peer id. This map is protected