From c0e22ebccaefd8cc4263ddbb51277d80214a012b Mon Sep 17 00:00:00 2001 From: rbrunner7 Date: Wed, 25 Apr 2018 21:37:10 +0200 Subject: [PATCH] [RELEASE] Fix broken interactive daemon 'limit' commands plus RPC calls --- src/daemon/command_parser_executor.cpp | 6 ------ src/daemon/rpc_command_executor.cpp | 12 ++++++------ src/p2p/net_node.h | 4 ++-- src/rpc/core_rpc_server_commands_defs.h | 2 +- 4 files changed, 9 insertions(+), 15 deletions(-) diff --git a/src/daemon/command_parser_executor.cpp b/src/daemon/command_parser_executor.cpp index 7a89ebc0c..fd8c26f48 100644 --- a/src/daemon/command_parser_executor.cpp +++ b/src/daemon/command_parser_executor.cpp @@ -379,8 +379,6 @@ bool t_command_parser_executor::set_limit(const std::vector& args) std::cout << "failed to parse argument" << std::endl; return false; } - if (limit > 0) - limit *= 1024; return m_executor.set_limit(limit, limit); } @@ -399,8 +397,6 @@ bool t_command_parser_executor::set_limit_up(const std::vector& arg std::cout << "failed to parse argument" << std::endl; return false; } - if (limit > 0) - limit *= 1024; return m_executor.set_limit(0, limit); } @@ -419,8 +415,6 @@ bool t_command_parser_executor::set_limit_down(const std::vector& a std::cout << "failed to parse argument" << std::endl; return false; } - if (limit > 0) - limit *= 1024; return m_executor.set_limit(limit, 0); } diff --git a/src/daemon/rpc_command_executor.cpp b/src/daemon/rpc_command_executor.cpp index 73b8d1a18..64ce3a406 100644 --- a/src/daemon/rpc_command_executor.cpp +++ b/src/daemon/rpc_command_executor.cpp @@ -1176,8 +1176,8 @@ bool t_rpc_command_executor::get_limit() } } - tools::msg_writer() << "limit-down is " << res.limit_down/1024 << " kB/s"; - tools::msg_writer() << "limit-up is " << res.limit_up/1024 << " kB/s"; + tools::msg_writer() << "limit-down is " << res.limit_down << " kB/s"; + tools::msg_writer() << "limit-up is " << res.limit_up << " kB/s"; return true; } @@ -1207,8 +1207,8 @@ bool t_rpc_command_executor::set_limit(int64_t limit_down, int64_t limit_up) } } - tools::msg_writer() << "Set limit-down to " << res.limit_down/1024 << " kB/s"; - tools::msg_writer() << "Set limit-up to " << res.limit_up/1024 << " kB/s"; + tools::msg_writer() << "Set limit-down to " << res.limit_down << " kB/s"; + tools::msg_writer() << "Set limit-up to " << res.limit_up << " kB/s"; return true; } @@ -1235,7 +1235,7 @@ bool t_rpc_command_executor::get_limit_up() } } - tools::msg_writer() << "limit-up is " << res.limit_up/1024 << " kB/s"; + tools::msg_writer() << "limit-up is " << res.limit_up << " kB/s"; return true; } @@ -1262,7 +1262,7 @@ bool t_rpc_command_executor::get_limit_down() } } - tools::msg_writer() << "limit-down is " << res.limit_down/1024 << " kB/s"; + tools::msg_writer() << "limit-down is " << res.limit_down << " kB/s"; return true; } diff --git a/src/p2p/net_node.h b/src/p2p/net_node.h index 3010b43ad..4606f66ee 100644 --- a/src/p2p/net_node.h +++ b/src/p2p/net_node.h @@ -334,8 +334,8 @@ namespace nodetool cryptonote::network_type m_nettype; }; - const int64_t default_limit_up = 2048; - const int64_t default_limit_down = 8192; + const int64_t default_limit_up = 2048; // kB/s + const int64_t default_limit_down = 8192; // kB/s extern const command_line::arg_descriptor arg_p2p_bind_ip; extern const command_line::arg_descriptor arg_p2p_bind_port; extern const command_line::arg_descriptor arg_p2p_external_port; diff --git a/src/rpc/core_rpc_server_commands_defs.h b/src/rpc/core_rpc_server_commands_defs.h index df5b4893f..070eb959d 100644 --- a/src/rpc/core_rpc_server_commands_defs.h +++ b/src/rpc/core_rpc_server_commands_defs.h @@ -1705,7 +1705,7 @@ namespace cryptonote { struct request { - int64_t limit_down; + int64_t limit_down; // all limits (for get and set) are kB/s int64_t limit_up; BEGIN_KV_SERIALIZE_MAP()