|
|
|
@ -60,8 +60,13 @@ namespace {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void print_peer(std::string const & prefix, cryptonote::peer const & peer)
|
|
|
|
|
void print_peer(std::string const & prefix, cryptonote::peer const & peer, bool pruned_only, bool publicrpc_only)
|
|
|
|
|
{
|
|
|
|
|
if (pruned_only && peer.pruning_seed == 0)
|
|
|
|
|
return;
|
|
|
|
|
if (publicrpc_only && peer.rpc_port == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
time_t now;
|
|
|
|
|
time(&now);
|
|
|
|
|
time_t last_seen = static_cast<time_t>(peer.last_seen);
|
|
|
|
@ -169,7 +174,7 @@ t_rpc_command_executor::~t_rpc_command_executor()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool t_rpc_command_executor::print_peer_list(bool white, bool gray, size_t limit) {
|
|
|
|
|
bool t_rpc_command_executor::print_peer_list(bool white, bool gray, size_t limit, bool pruned_only, bool publicrpc_only) {
|
|
|
|
|
cryptonote::COMMAND_RPC_GET_PEER_LIST::request req;
|
|
|
|
|
cryptonote::COMMAND_RPC_GET_PEER_LIST::response res;
|
|
|
|
|
|
|
|
|
@ -196,7 +201,7 @@ bool t_rpc_command_executor::print_peer_list(bool white, bool gray, size_t limit
|
|
|
|
|
const auto end = limit ? peer + std::min(limit, res.white_list.size()) : res.white_list.cend();
|
|
|
|
|
for (; peer != end; ++peer)
|
|
|
|
|
{
|
|
|
|
|
print_peer("white", *peer);
|
|
|
|
|
print_peer("white", *peer, pruned_only, publicrpc_only);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -206,7 +211,7 @@ bool t_rpc_command_executor::print_peer_list(bool white, bool gray, size_t limit
|
|
|
|
|
const auto end = limit ? peer + std::min(limit, res.gray_list.size()) : res.gray_list.cend();
|
|
|
|
|
for (; peer != end; ++peer)
|
|
|
|
|
{
|
|
|
|
|
print_peer("gray", *peer);
|
|
|
|
|
print_peer("gray", *peer, pruned_only, publicrpc_only);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|