| 2861 | } |
| 2862 | |
| 2863 | size_t CConnman::GetNodeCount(ConnectionDirection flags) const |
| 2864 | { |
| 2865 | LOCK(m_nodes_mutex); |
| 2866 | if (flags == ConnectionDirection::Both) // Shortcut if we want total |
| 2867 | return m_nodes.size(); |
| 2868 | |
| 2869 | int nNum = 0; |
| 2870 | for (const auto& pnode : m_nodes) { |
| 2871 | if (flags & (pnode->IsInboundConn() ? ConnectionDirection::In : ConnectionDirection::Out)) { |
| 2872 | nNum++; |
| 2873 | } |
| 2874 | } |
| 2875 | |
| 2876 | return nNum; |
| 2877 | } |
| 2878 | |
| 2879 | void CConnman::GetNodeStats(std::vector<CNodeStats>& vstats) const |
| 2880 | { |