diff options
author | Amiti Uttarwar <amiti@uttarwar.org> | 2023-06-11 12:26:18 -0700 |
---|---|---|
committer | Amiti Uttarwar <amiti@uttarwar.org> | 2023-08-03 12:46:24 -0600 |
commit | 654d9bc27647fb3797001472e2464dededb45d3f (patch) | |
tree | 33830ba2d23b199b532ec309ab2d78089abf0b09 /src/net.cpp | |
parent | 6a473373d4953cabbb219eae8b709150a45796e6 (diff) |
p2p: Introduce data struct to track connection counts by network
Connman uses this new map to keep a count of active OUTBOUND_FULL_RELAY and
MANUAL connections. Unused until next commit.
Co-authored-by: Martin Zumsande <mzumsande@gmail.com>
Diffstat (limited to 'src/net.cpp')
-rw-r--r-- | src/net.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/net.cpp b/src/net.cpp index 282c8fb741..bfbca4baf8 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -1135,6 +1135,9 @@ void CConnman::DisconnectNodes() // close socket and cleanup pnode->CloseSocketDisconnect(); + // update connection count by network + if (pnode->IsManualOrFullOutboundConn()) --m_network_conn_counts[pnode->addr.GetNetwork()]; + // hold in disconnected pool until all refs are released pnode->Release(); m_nodes_disconnected.push_back(pnode); @@ -2035,6 +2038,9 @@ void CConnman::OpenNetworkConnection(const CAddress& addrConnect, bool fCountFai { LOCK(m_nodes_mutex); m_nodes.push_back(pnode); + + // update connection count by network + if (pnode->IsManualOrFullOutboundConn()) ++m_network_conn_counts[pnode->addr.GetNetwork()]; } } |