Skip to content

Commit 3726a45

Browse files
committed
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.
1 parent 7d52ff5 commit 3726a45

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/net.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1100,7 +1100,7 @@ class CConnman
11001100
std::deque<std::string> m_addr_fetches GUARDED_BY(m_addr_fetches_mutex);
11011101
Mutex m_addr_fetches_mutex;
11021102
std::vector<std::string> m_added_nodes GUARDED_BY(m_added_nodes_mutex);
1103-
mutable RecursiveMutex m_added_nodes_mutex;
1103+
mutable Mutex m_added_nodes_mutex;
11041104
std::vector<CNode*> m_nodes GUARDED_BY(m_nodes_mutex);
11051105
std::list<CNode*> m_nodes_disconnected;
11061106
mutable RecursiveMutex m_nodes_mutex;

0 commit comments

Comments
 (0)