From 3726a4595837b66d37f151faf1cec2796d6b74d7 Mon Sep 17 00:00:00 2001 From: Sebastian Falbesoner Date: Sat, 28 Aug 2021 21:02:28 +0200 Subject: [PATCH] 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. --- src/net.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/net.h b/src/net.h index 93d36a6e3d..dd5cc66a04 100644 --- a/src/net.h +++ b/src/net.h @@ -1100,7 +1100,7 @@ private: std::deque m_addr_fetches GUARDED_BY(m_addr_fetches_mutex); Mutex m_addr_fetches_mutex; std::vector m_added_nodes GUARDED_BY(m_added_nodes_mutex); - mutable RecursiveMutex m_added_nodes_mutex; + mutable Mutex m_added_nodes_mutex; std::vector m_nodes GUARDED_BY(m_nodes_mutex); std::list m_nodes_disconnected; mutable RecursiveMutex m_nodes_mutex;