refactor: replace RecursiveMutex m_addr_fetches_mutex with Mutex

The RecursiveMutex m_addr_fetches_mutex is used at three places:
    - CConnman::AddAddrFetch()
    - CConnman::ProcessAddrFetch()
    - CConnman::ThreadOpenConnections()
In each of the critical sections, only the the m_addr_fetches is accessed
(and in the last case, also vAddedNodes), without any chance that within
one section another one is called. Hence, we can use an ordinary Mutex
instead of RecursiveMutex.
This commit is contained in:
Sebastian Falbesoner 2021-08-28 19:59:41 +02:00
parent d51d2a3bb5
commit 7d52ff5c38

View file

@ -1098,7 +1098,7 @@ private:
bool fAddressesInitialized{false};
AddrMan& addrman;
std::deque<std::string> m_addr_fetches GUARDED_BY(m_addr_fetches_mutex);
RecursiveMutex 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;
std::vector<CNode*> m_nodes GUARDED_BY(m_nodes_mutex);