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 ADDR_FETCH and FEELER) 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)
| 1889 | // (so that we don't decide we're over our desired connection limit, and then |
| 1890 | // evict some peer that has finished the handshake) |
| 1891 | int CConnman::GetExtraFullOutboundCount() const |
| 1892 | { |
| 1893 | int full_outbound_peers = 0; |
| 1894 | { |
| 1895 | LOCK(m_nodes_mutex); |
| 1896 | for (const CNode* pnode : m_nodes) { |
| 1897 | if (pnode->fSuccessfullyConnected && !pnode->fDisconnect && pnode->IsFullOutboundConn()) { |
| 1898 | ++full_outbound_peers; |
| 1899 | } |
| 1900 | } |
| 1901 | } |
| 1902 | return std::max(full_outbound_peers - m_max_outbound_full_relay, 0); |
| 1903 | } |
| 1904 | |
| 1905 | int CConnman::GetExtraBlockRelayCount() const |
| 1906 | { |