CConnman::FindNode()
would lock m_nodes_mutex
, find the node in m_nodes
, release the mutex and return the node. The current code is safe but it is a dangerous interface where a caller may end up using the node returned from FindNode()
without owning m_nodes_mutex
and without having that node’s reference count incremented.
Change FindNode()
to return a boolean since all but one of its callers used its return value to check whether a node exists and did not do anything else with the return value.
Remove a recursive lock on m_nodes_mutex
.
Rename FindNode()
to better describe what it does.