MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / GetExtraOutboundCount

Method GetExtraOutboundCount

src/net.cpp:1730–1742  ·  view source on GitHub ↗

Return the number of peers we have over our outbound connection limit Exclude peers that are marked for disconnect, or are going to be disconnected soon (eg one-shots and feelers) Also exclude peers that haven't finished initial connection handshake yet (so that we don't decide we're over our desired connection limit, and then evict some peer that has finished the handshake)

Source from the content-addressed store, hash-verified

1728// (so that we don't decide we're over our desired connection limit, and then
1729// evict some peer that has finished the handshake)
1730int CConnman::GetExtraOutboundCount()
1731{
1732 int nOutbound = 0;
1733 {
1734 LOCK(cs_vNodes);
1735 for (CNode* pnode : vNodes) {
1736 if (!pnode->fInbound && !pnode->m_manual_connection && !pnode->fFeeler && !pnode->fDisconnect && !pnode->fOneShot && pnode->fSuccessfullyConnected) {
1737 ++nOutbound;
1738 }
1739 }
1740 }
1741 return std::max(nOutbound - nMaxOutbound, 0);
1742}
1743
1744void CConnman::ThreadOpenConnections(const std::vector<std::string> connect)
1745{

Callers 1

Calls 1

maxFunction · 0.85

Tested by

no test coverage detected