aboutsummaryrefslogtreecommitdiff
path: root/src/daemon
diff options
context:
space:
mode:
Diffstat (limited to 'src/daemon')
-rw-r--r--src/daemon/command_parser_executor.cpp15
-rw-r--r--src/daemon/rpc_command_executor.cpp23
-rw-r--r--src/daemon/rpc_command_executor.h6
3 files changed, 41 insertions, 3 deletions
diff --git a/src/daemon/command_parser_executor.cpp b/src/daemon/command_parser_executor.cpp
index fd7b40be2..1b86ff269 100644
--- a/src/daemon/command_parser_executor.cpp
+++ b/src/daemon/command_parser_executor.cpp
@@ -251,7 +251,10 @@ bool t_command_parser_executor::print_status(const std::vector<std::string>& arg
bool t_command_parser_executor::set_limit(const std::vector<std::string>& args)
{
- if(args.size()!=1) return false;
+ if(args.size()>1) return false;
+ if(args.size()==0) {
+ return m_executor.get_limit();
+ }
int limit;
try {
limit = std::stoi(args[0]);
@@ -267,7 +270,10 @@ bool t_command_parser_executor::set_limit(const std::vector<std::string>& args)
bool t_command_parser_executor::set_limit_up(const std::vector<std::string>& args)
{
- if(args.size()!=1) return false;
+ if(args.size()>1) return false;
+ if(args.size()==0) {
+ return m_executor.get_limit_up();
+ }
int limit;
try {
limit = std::stoi(args[0]);
@@ -283,7 +289,10 @@ bool t_command_parser_executor::set_limit_up(const std::vector<std::string>& arg
bool t_command_parser_executor::set_limit_down(const std::vector<std::string>& args)
{
- if(args.size()!=1) return false;
+ if(args.size()>1) return false;
+ if(args.size()==0) {
+ return m_executor.get_limit_down();
+ }
int limit;
try {
limit = std::stoi(args[0]);
diff --git a/src/daemon/rpc_command_executor.cpp b/src/daemon/rpc_command_executor.cpp
index 8ef91600c..79b52711a 100644
--- a/src/daemon/rpc_command_executor.cpp
+++ b/src/daemon/rpc_command_executor.cpp
@@ -737,6 +737,15 @@ bool t_rpc_command_executor::print_status()
return true;
}
+bool t_rpc_command_executor::get_limit()
+{
+ int limit_down = epee::net_utils::connection_basic::get_rate_down_limit( );
+ int limit_up = epee::net_utils::connection_basic::get_rate_up_limit( );
+ std::cout << "limit-down is " << limit_down/1024 << " kB/s" << std::endl;
+ std::cout << "limit-up is " << limit_up/1024 << " kB/s" << std::endl;
+ return true;
+}
+
bool t_rpc_command_executor::set_limit(int limit)
{
epee::net_utils::connection_basic::set_rate_down_limit( limit );
@@ -746,6 +755,13 @@ bool t_rpc_command_executor::set_limit(int limit)
return true;
}
+bool t_rpc_command_executor::get_limit_up()
+{
+ int limit_up = epee::net_utils::connection_basic::get_rate_up_limit( );
+ std::cout << "limit-up is " << limit_up/1024 << " kB/s" << std::endl;
+ return true;
+}
+
bool t_rpc_command_executor::set_limit_up(int limit)
{
epee::net_utils::connection_basic::set_rate_up_limit( limit );
@@ -753,6 +769,13 @@ bool t_rpc_command_executor::set_limit_up(int limit)
return true;
}
+bool t_rpc_command_executor::get_limit_down()
+{
+ int limit_down = epee::net_utils::connection_basic::get_rate_down_limit( );
+ std::cout << "limit-down is " << limit_down/1024 << " kB/s" << std::endl;
+ return true;
+}
+
bool t_rpc_command_executor::set_limit_down(int limit)
{
epee::net_utils::connection_basic::set_rate_down_limit( limit );
diff --git a/src/daemon/rpc_command_executor.h b/src/daemon/rpc_command_executor.h
index 43b8a9fe0..21229c577 100644
--- a/src/daemon/rpc_command_executor.h
+++ b/src/daemon/rpc_command_executor.h
@@ -99,6 +99,12 @@ public:
bool print_status();
+ bool get_limit();
+
+ bool get_limit_up();
+
+ bool get_limit_down();
+
bool set_limit(int limit);
bool set_limit_up(int limit);