aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/core_rpc_server.cpp
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2019-08-20 01:50:10 -0500
committerluigi1111 <luigi1111w@gmail.com>2019-08-20 01:50:10 -0500
commitc9df9d683acd361d1326814470d941d42cdd9b0f (patch)
treeff36a5c17adf5621974be829a5d9fcbe232d1055 /src/rpc/core_rpc_server.cpp
parentMerge pull request #5636 (diff)
parentdaemon: fix print_pl only printing public zone peers (diff)
downloadmonero-c9df9d683acd361d1326814470d941d42cdd9b0f.tar.xz
Merge pull request #5696
fd60d05 daemon: fix print_pl only printing public zone peers (moneromooo-monero)
Diffstat (limited to 'src/rpc/core_rpc_server.cpp')
-rw-r--r--src/rpc/core_rpc_server.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/rpc/core_rpc_server.cpp b/src/rpc/core_rpc_server.cpp
index 1a854d21c..73138686d 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);