Switch to using smart pointers to CNode
s inside of CConnman
.
Currently we are manually refcounting CNodes which is potentially error-prone and makes operations such as deleting them from multiple threads difficult without introducing new locks or other synchronisation operations (see #27912).
Switch to using std::shared_ptr
references to CNode
s inside of m_nodes
and m_nodes_disconnected
to give us better memory safety today, and in the future allow AttemptToEvictConnection
(and optionally other sites) to safely synchronously disconnect nodes when needed.
Opening as draft for now as I want to both gauge feedback on the approach, and see which PRs this may conflict with (#27213?) before moving it forwards.
CC @vasild