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)
| 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) |
| 1730 | int 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 | |
| 1744 | void CConnman::ThreadOpenConnections(const std::vector<std::string> connect) |
| 1745 | { |
no test coverage detected