mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-08-15 01:03:23 +00:00
Add print_pl_stats daemon command
This commit is contained in:
parent
d666339853
commit
3bdda60f3e
5 changed files with 44 additions and 0 deletions
|
@ -51,6 +51,13 @@ bool t_command_parser_executor::print_peer_list(const std::vector<std::string>&
|
||||||
return m_executor.print_peer_list();
|
return m_executor.print_peer_list();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool t_command_parser_executor::print_peer_list_stats(const std::vector<std::string>& args)
|
||||||
|
{
|
||||||
|
if (!args.empty()) return false;
|
||||||
|
|
||||||
|
return m_executor.print_peer_list_stats();
|
||||||
|
}
|
||||||
|
|
||||||
bool t_command_parser_executor::save_blockchain(const std::vector<std::string>& args)
|
bool t_command_parser_executor::save_blockchain(const std::vector<std::string>& args)
|
||||||
{
|
{
|
||||||
if (!args.empty()) return false;
|
if (!args.empty()) return false;
|
||||||
|
|
|
@ -59,6 +59,8 @@ public:
|
||||||
|
|
||||||
bool print_peer_list(const std::vector<std::string>& args);
|
bool print_peer_list(const std::vector<std::string>& args);
|
||||||
|
|
||||||
|
bool print_peer_list_stats(const std::vector<std::string>& args);
|
||||||
|
|
||||||
bool save_blockchain(const std::vector<std::string>& args);
|
bool save_blockchain(const std::vector<std::string>& args);
|
||||||
|
|
||||||
bool show_hash_rate(const std::vector<std::string>& args);
|
bool show_hash_rate(const std::vector<std::string>& args);
|
||||||
|
|
|
@ -68,6 +68,11 @@ t_command_server::t_command_server(
|
||||||
, std::bind(&t_command_parser_executor::print_peer_list, &m_parser, p::_1)
|
, std::bind(&t_command_parser_executor::print_peer_list, &m_parser, p::_1)
|
||||||
, "Print peer list"
|
, "Print peer list"
|
||||||
);
|
);
|
||||||
|
m_command_lookup.set_handler(
|
||||||
|
"print_pl_stats"
|
||||||
|
, std::bind(&t_command_parser_executor::print_peer_list_stats, &m_parser, p::_1)
|
||||||
|
, "Print peer list stats"
|
||||||
|
);
|
||||||
m_command_lookup.set_handler(
|
m_command_lookup.set_handler(
|
||||||
"print_cn"
|
"print_cn"
|
||||||
, std::bind(&t_command_parser_executor::print_connections, &m_parser, p::_1)
|
, std::bind(&t_command_parser_executor::print_connections, &m_parser, p::_1)
|
||||||
|
|
|
@ -162,6 +162,34 @@ bool t_rpc_command_executor::print_peer_list() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool t_rpc_command_executor::print_peer_list_stats() {
|
||||||
|
cryptonote::COMMAND_RPC_GET_PEER_LIST::request req;
|
||||||
|
cryptonote::COMMAND_RPC_GET_PEER_LIST::response res;
|
||||||
|
|
||||||
|
std::string failure_message = "Couldn't retrieve peer list";
|
||||||
|
if (m_is_rpc)
|
||||||
|
{
|
||||||
|
if (!m_rpc_client->rpc_request(req, res, "/get_peer_list", failure_message.c_str()))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!m_rpc_server->on_get_peer_list(req, res) || res.status != CORE_RPC_STATUS_OK)
|
||||||
|
{
|
||||||
|
tools::fail_msg_writer() << failure_message;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tools::msg_writer()
|
||||||
|
<< "White list size: " << res.white_list.size() << "/" << P2P_LOCAL_WHITE_PEERLIST_LIMIT << " (" << res.white_list.size() * 100.0 / P2P_LOCAL_WHITE_PEERLIST_LIMIT << "%)" << std::endl
|
||||||
|
<< "Gray list size: " << res.gray_list.size() << "/" << P2P_LOCAL_GRAY_PEERLIST_LIMIT << " (" << res.gray_list.size() * 100.0 / P2P_LOCAL_GRAY_PEERLIST_LIMIT << "%)";
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool t_rpc_command_executor::save_blockchain() {
|
bool t_rpc_command_executor::save_blockchain() {
|
||||||
cryptonote::COMMAND_RPC_SAVE_BC::request req;
|
cryptonote::COMMAND_RPC_SAVE_BC::request req;
|
||||||
cryptonote::COMMAND_RPC_SAVE_BC::response res;
|
cryptonote::COMMAND_RPC_SAVE_BC::response res;
|
||||||
|
|
|
@ -72,6 +72,8 @@ public:
|
||||||
|
|
||||||
bool print_peer_list();
|
bool print_peer_list();
|
||||||
|
|
||||||
|
bool print_peer_list_stats();
|
||||||
|
|
||||||
bool save_blockchain();
|
bool save_blockchain();
|
||||||
|
|
||||||
bool show_hash_rate();
|
bool show_hash_rate();
|
||||||
|
|
Loading…
Reference in a new issue