mirror of
https://github.com/monero-project/monero.git
synced 2025-07-25 10:15:21 -04:00
Merge pull request #5080
d294a577
daemon: extend 'print_pl' command, optional filter by type and limit (xiphon)
This commit is contained in:
commit
23c7663167
4 changed files with 44 additions and 8 deletions
|
@ -156,7 +156,7 @@ t_rpc_command_executor::~t_rpc_command_executor()
|
|||
}
|
||||
}
|
||||
|
||||
bool t_rpc_command_executor::print_peer_list() {
|
||||
bool t_rpc_command_executor::print_peer_list(bool white, bool gray, size_t limit) {
|
||||
cryptonote::COMMAND_RPC_GET_PEER_LIST::request req;
|
||||
cryptonote::COMMAND_RPC_GET_PEER_LIST::response res;
|
||||
|
||||
|
@ -177,14 +177,24 @@ bool t_rpc_command_executor::print_peer_list() {
|
|||
}
|
||||
}
|
||||
|
||||
for (auto & peer : res.white_list)
|
||||
if (white)
|
||||
{
|
||||
print_peer("white", peer);
|
||||
auto peer = res.white_list.cbegin();
|
||||
const auto end = limit ? peer + std::min(limit, res.white_list.size()) : res.white_list.cend();
|
||||
for (; peer != end; ++peer)
|
||||
{
|
||||
print_peer("white", *peer);
|
||||
}
|
||||
}
|
||||
|
||||
for (auto & peer : res.gray_list)
|
||||
if (gray)
|
||||
{
|
||||
print_peer("gray", peer);
|
||||
auto peer = res.gray_list.cbegin();
|
||||
const auto end = limit ? peer + std::min(limit, res.gray_list.size()) : res.gray_list.cend();
|
||||
for (; peer != end; ++peer)
|
||||
{
|
||||
print_peer("gray", *peer);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue