aboutsummaryrefslogtreecommitdiff
path: root/src/daemon/command_parser_executor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/daemon/command_parser_executor.cpp')
-rw-r--r--src/daemon/command_parser_executor.cpp46
1 files changed, 27 insertions, 19 deletions
diff --git a/src/daemon/command_parser_executor.cpp b/src/daemon/command_parser_executor.cpp
index d949a57b1..af46453cd 100644
--- a/src/daemon/command_parser_executor.cpp
+++ b/src/daemon/command_parser_executor.cpp
@@ -125,12 +125,17 @@ bool t_command_parser_executor::print_blockchain_info(const std::vector<std::str
bool t_command_parser_executor::set_log_level(const std::vector<std::string>& args)
{
- if(args.size() != 1)
+ if(args.size() > 1)
{
std::cout << "use: set_log [<log_level_number_0-4> | <categories>]" << std::endl;
return true;
}
+ if (args.empty())
+ {
+ return m_executor.set_log_categories("+");
+ }
+
uint16_t l = 0;
if(epee::string_tools::get_xtype_from_string(l, args[0]))
{
@@ -334,17 +339,18 @@ bool t_command_parser_executor::set_limit(const std::vector<std::string>& args)
if(args.size()==0) {
return m_executor.get_limit();
}
- int limit;
+ int64_t limit;
try {
- limit = std::stoi(args[0]);
+ limit = std::stoll(args[0]);
}
- catch(std::invalid_argument& ex) {
+ catch(const std::invalid_argument& ex) {
+ std::cout << "failed to parse argument" << std::endl;
return false;
}
- if (limit==-1) limit=128;
- limit *= 1024;
+ if (limit > 0)
+ limit *= 1024;
- return m_executor.set_limit(limit);
+ return m_executor.set_limit(limit, limit);
}
bool t_command_parser_executor::set_limit_up(const std::vector<std::string>& args)
@@ -353,17 +359,18 @@ bool t_command_parser_executor::set_limit_up(const std::vector<std::string>& arg
if(args.size()==0) {
return m_executor.get_limit_up();
}
- int limit;
+ int64_t limit;
try {
- limit = std::stoi(args[0]);
+ limit = std::stoll(args[0]);
}
- catch(std::invalid_argument& ex) {
+ catch(const std::invalid_argument& ex) {
+ std::cout << "failed to parse argument" << std::endl;
return false;
}
- if (limit==-1) limit=128;
- limit *= 1024;
+ if (limit > 0)
+ limit *= 1024;
- return m_executor.set_limit_up(limit);
+ return m_executor.set_limit(0, limit);
}
bool t_command_parser_executor::set_limit_down(const std::vector<std::string>& args)
@@ -372,17 +379,18 @@ bool t_command_parser_executor::set_limit_down(const std::vector<std::string>& a
if(args.size()==0) {
return m_executor.get_limit_down();
}
- int limit;
+ int64_t limit;
try {
- limit = std::stoi(args[0]);
+ limit = std::stoll(args[0]);
}
- catch(std::invalid_argument& ex) {
+ catch(const std::invalid_argument& ex) {
+ std::cout << "failed to parse argument" << std::endl;
return false;
}
- if (limit==-1) limit=128;
- limit *= 1024;
+ if (limit > 0)
+ limit *= 1024;
- return m_executor.set_limit_down(limit);
+ return m_executor.set_limit(limit, 0);
}
bool t_command_parser_executor::out_peers(const std::vector<std::string>& args)