diff options
author | Sebastian Falbesoner <sebastian.falbesoner@gmail.com> | 2021-08-28 21:02:28 +0200 |
---|---|---|
committer | Sebastian Falbesoner <sebastian.falbesoner@gmail.com> | 2021-11-24 19:34:26 +0100 |
commit | 3726a4595837b66d37f151faf1cec2796d6b74d7 (patch) | |
tree | 9978b2b75ae7c381dd3041aec93541adf815d644 | |
parent | 7d52ff5c389643cde613d86fee33d7087f47b8b4 (diff) | |
download | bitcoin-3726a4595837b66d37f151faf1cec2796d6b74d7.tar.xz |
refactor: replace RecursiveMutex m_added_nodes_mutex with Mutex
The RecursiveMutex m_added_nodes_mutex is used at three places:
- CConnman::GetAddedNodeInfo()
- CConnman::AddNode()
- CConnman::ThreadOpenConnections()
In each of the critical sections, only the the m_added_nodes member is
accessed (and in the last case, also m_addr_fetches), without any chance
that within one section another one is called. Hence, we can use an
ordinary Mutex instead of RecursiveMutex.
-rw-r--r-- | src/net.h | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -1100,7 +1100,7 @@ private: std::deque<std::string> m_addr_fetches GUARDED_BY(m_addr_fetches_mutex); Mutex m_addr_fetches_mutex; std::vector<std::string> m_added_nodes GUARDED_BY(m_added_nodes_mutex); - mutable RecursiveMutex m_added_nodes_mutex; + mutable Mutex m_added_nodes_mutex; std::vector<CNode*> m_nodes GUARDED_BY(m_nodes_mutex); std::list<CNode*> m_nodes_disconnected; mutable RecursiveMutex m_nodes_mutex; |