| 119 | return m_context->connman ? m_context->connman->GetNodeCount(flags) : 0; |
| 120 | } |
| 121 | bool getNodesStats(NodesStats& stats) override |
| 122 | { |
| 123 | stats.clear(); |
| 124 | |
| 125 | if (m_context->connman) { |
| 126 | std::vector<CNodeStats> stats_temp; |
| 127 | m_context->connman->GetNodeStats(stats_temp); |
| 128 | |
| 129 | stats.reserve(stats_temp.size()); |
| 130 | for (auto& node_stats_temp : stats_temp) { |
| 131 | stats.emplace_back(std::move(node_stats_temp), false, CNodeStateStats()); |
| 132 | } |
| 133 | |
| 134 | // Try to retrieve the CNodeStateStats for each node. |
| 135 | if (m_context->peerman) { |
| 136 | TRY_LOCK(::cs_main, lockMain); |
| 137 | if (lockMain) { |
| 138 | for (auto& node_stats : stats) { |
| 139 | std::get<1>(node_stats) = |
| 140 | m_context->peerman->GetNodeStateStats(std::get<0>(node_stats).nodeid, std::get<2>(node_stats)); |
| 141 | } |
| 142 | } |
| 143 | } |
| 144 | return true; |
| 145 | } |
| 146 | return false; |
| 147 | } |
| 148 | bool getBanned(banmap_t& banmap) override |
| 149 | { |
| 150 | if (m_context->banman) { |
no test coverage detected