diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2019-06-26 09:14:23 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2019-08-19 23:39:51 +0000 |
commit | fd60d05d5d0c50790f518e7c58f11d73193fc249 (patch) | |
tree | 9566cc8f7e87d8d5008ccbc02014b113307611cd /src/rpc/core_rpc_server.cpp | |
parent | Merge pull request #5685 (diff) | |
download | monero-fd60d05d5d0c50790f518e7c58f11d73193fc249.tar.xz |
daemon: fix print_pl only printing public zone peers
Diffstat (limited to 'src/rpc/core_rpc_server.cpp')
-rw-r--r-- | src/rpc/core_rpc_server.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/rpc/core_rpc_server.cpp b/src/rpc/core_rpc_server.cpp index 9aaaa026d..daec8cd58 100644 --- a/src/rpc/core_rpc_server.cpp +++ b/src/rpc/core_rpc_server.cpp @@ -1044,31 +1044,35 @@ namespace cryptonote PERF_TIMER(on_get_peer_list); std::vector<nodetool::peerlist_entry> white_list; std::vector<nodetool::peerlist_entry> gray_list; - m_p2p.get_public_peerlist(gray_list, white_list); - res.white_list.reserve(white_list.size()); + if (req.public_only) + { + m_p2p.get_public_peerlist(gray_list, white_list); + } + else + { + m_p2p.get_peerlist(gray_list, white_list); + } + for (auto & entry : white_list) { if (entry.adr.get_type_id() == epee::net_utils::ipv4_network_address::get_type_id()) res.white_list.emplace_back(entry.id, entry.adr.as<epee::net_utils::ipv4_network_address>().ip(), entry.adr.as<epee::net_utils::ipv4_network_address>().port(), entry.last_seen, entry.pruning_seed, entry.rpc_port); else if (entry.adr.get_type_id() == epee::net_utils::ipv6_network_address::get_type_id()) - { res.white_list.emplace_back(entry.id, entry.adr.as<epee::net_utils::ipv6_network_address>().host_str(), entry.adr.as<epee::net_utils::ipv6_network_address>().port(), entry.last_seen, entry.pruning_seed, entry.rpc_port); - } else res.white_list.emplace_back(entry.id, entry.adr.str(), entry.last_seen, entry.pruning_seed, entry.rpc_port); } - res.gray_list.reserve(gray_list.size()); for (auto & entry : gray_list) { if (entry.adr.get_type_id() == epee::net_utils::ipv4_network_address::get_type_id()) res.gray_list.emplace_back(entry.id, entry.adr.as<epee::net_utils::ipv4_network_address>().ip(), entry.adr.as<epee::net_utils::ipv4_network_address>().port(), entry.last_seen, entry.pruning_seed, entry.rpc_port); else if (entry.adr.get_type_id() == epee::net_utils::ipv6_network_address::get_type_id()) - res.white_list.emplace_back(entry.id, entry.adr.as<epee::net_utils::ipv6_network_address>().host_str(), + res.gray_list.emplace_back(entry.id, entry.adr.as<epee::net_utils::ipv6_network_address>().host_str(), entry.adr.as<epee::net_utils::ipv6_network_address>().port(), entry.last_seen, entry.pruning_seed, entry.rpc_port); else res.gray_list.emplace_back(entry.id, entry.adr.str(), entry.last_seen, entry.pruning_seed, entry.rpc_port); |