mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2025-07-07 02:18:22 +00:00
rpc: in/out peers can now return the setting's value
This commit is contained in:
parent
5fbfa8a656
commit
fcfcc3ac86
7 changed files with 63 additions and 21 deletions
|
@ -1465,13 +1465,14 @@ bool t_rpc_command_executor::get_limit_down()
|
|||
return true;
|
||||
}
|
||||
|
||||
bool t_rpc_command_executor::out_peers(uint64_t limit)
|
||||
bool t_rpc_command_executor::out_peers(bool set, uint32_t limit)
|
||||
{
|
||||
cryptonote::COMMAND_RPC_OUT_PEERS::request req;
|
||||
cryptonote::COMMAND_RPC_OUT_PEERS::response res;
|
||||
|
||||
epee::json_rpc::error error_resp;
|
||||
|
||||
req.set = set;
|
||||
req.out_peers = limit;
|
||||
|
||||
std::string fail_message = "Unsuccessful";
|
||||
|
@ -1492,18 +1493,20 @@ bool t_rpc_command_executor::out_peers(uint64_t limit)
|
|||
}
|
||||
}
|
||||
|
||||
tools::msg_writer() << "Max number of out peers set to " << limit << std::endl;
|
||||
const std::string s = res.out_peers == (uint32_t)-1 ? "unlimited" : std::to_string(res.out_peers);
|
||||
tools::msg_writer() << "Max number of out peers set to " << s << std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool t_rpc_command_executor::in_peers(uint64_t limit)
|
||||
bool t_rpc_command_executor::in_peers(bool set, uint32_t limit)
|
||||
{
|
||||
cryptonote::COMMAND_RPC_IN_PEERS::request req;
|
||||
cryptonote::COMMAND_RPC_IN_PEERS::response res;
|
||||
|
||||
epee::json_rpc::error error_resp;
|
||||
|
||||
req.set = set;
|
||||
req.in_peers = limit;
|
||||
|
||||
std::string fail_message = "Unsuccessful";
|
||||
|
@ -1524,7 +1527,8 @@ bool t_rpc_command_executor::in_peers(uint64_t limit)
|
|||
}
|
||||
}
|
||||
|
||||
tools::msg_writer() << "Max number of in peers set to " << limit << std::endl;
|
||||
const std::string s = res.in_peers == (uint32_t)-1 ? "unlimited" : std::to_string(res.in_peers);
|
||||
tools::msg_writer() << "Max number of in peers set to " << s << std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue