aboutsummaryrefslogtreecommitdiff
path: root/src/daemon
diff options
context:
space:
mode:
Diffstat (limited to 'src/daemon')
-rw-r--r--src/daemon/command_line_args.h5
-rw-r--r--src/daemon/command_parser_executor.cpp19
-rw-r--r--src/daemon/main.cpp6
-rw-r--r--src/daemon/rpc_command_executor.cpp4
4 files changed, 29 insertions, 5 deletions
diff --git a/src/daemon/command_line_args.h b/src/daemon/command_line_args.h
index 4673590aa..cba71bf3b 100644
--- a/src/daemon/command_line_args.h
+++ b/src/daemon/command_line_args.h
@@ -72,6 +72,11 @@ namespace daemon_args
, "Specify maximum log file size [B]"
, MAX_LOG_FILE_SIZE
};
+ const command_line::arg_descriptor<std::size_t> arg_max_log_files = {
+ "max-log-files"
+ , "Specify maximum number of rotated log files to be saved (no limit by setting to 0)"
+ , MAX_LOG_FILES
+ };
const command_line::arg_descriptor<std::string> arg_log_level = {
"log-level"
, ""
diff --git a/src/daemon/command_parser_executor.cpp b/src/daemon/command_parser_executor.cpp
index 34d9fb4c8..aa688294d 100644
--- a/src/daemon/command_parser_executor.cpp
+++ b/src/daemon/command_parser_executor.cpp
@@ -27,6 +27,7 @@
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "common/dns_utils.h"
+#include "common/command_line.h"
#include "version.h"
#include "daemon/command_parser_executor.h"
@@ -326,12 +327,26 @@ bool t_command_parser_executor::start_mining(const std::vector<std::string>& arg
if(args.size() == 4)
{
- ignore_battery = args[3] == "true";
+ if(args[3] == "true" || command_line::is_yes(args[3]) || args[3] == "1")
+ {
+ ignore_battery = true;
+ }
+ else if(args[3] != "false" && !command_line::is_no(args[3]) && args[3] != "0")
+ {
+ return false;
+ }
}
if(args.size() >= 3)
{
- do_background_mining = args[2] == "true";
+ if(args[2] == "true" || command_line::is_yes(args[2]) || args[2] == "1")
+ {
+ do_background_mining = true;
+ }
+ else if(args[2] != "false" && !command_line::is_no(args[2]) && args[2] != "0")
+ {
+ return false;
+ }
}
if(args.size() >= 2)
diff --git a/src/daemon/main.cpp b/src/daemon/main.cpp
index 711de0736..82ece62a9 100644
--- a/src/daemon/main.cpp
+++ b/src/daemon/main.cpp
@@ -84,6 +84,7 @@ int main(int argc, char const * argv[])
command_line::add_arg(core_settings, daemon_args::arg_log_file);
command_line::add_arg(core_settings, daemon_args::arg_log_level);
command_line::add_arg(core_settings, daemon_args::arg_max_log_file_size);
+ command_line::add_arg(core_settings, daemon_args::arg_max_log_files);
command_line::add_arg(core_settings, daemon_args::arg_max_concurrency);
command_line::add_arg(core_settings, daemon_args::arg_zmq_rpc_bind_ip);
command_line::add_arg(core_settings, daemon_args::arg_zmq_rpc_bind_port);
@@ -204,7 +205,7 @@ int main(int argc, char const * argv[])
if (!command_line::is_arg_defaulted(vm, daemon_args::arg_log_file))
log_file_path = command_line::get_arg(vm, daemon_args::arg_log_file);
log_file_path = bf::absolute(log_file_path, relative_path_base);
- mlog_configure(log_file_path.string(), true, command_line::get_arg(vm, daemon_args::arg_max_log_file_size));
+ mlog_configure(log_file_path.string(), true, command_line::get_arg(vm, daemon_args::arg_max_log_file_size), command_line::get_arg(vm, daemon_args::arg_max_log_files));
// Set log level
if (!command_line::is_arg_defaulted(vm, daemon_args::arg_log_level))
@@ -263,6 +264,9 @@ int main(int argc, char const * argv[])
}
else
{
+#ifdef HAVE_READLINE
+ rdln::suspend_readline pause_readline;
+#endif
std::cerr << "Unknown command: " << command.front() << std::endl;
return 1;
}
diff --git a/src/daemon/rpc_command_executor.cpp b/src/daemon/rpc_command_executor.cpp
index 487853441..956c84a01 100644
--- a/src/daemon/rpc_command_executor.cpp
+++ b/src/daemon/rpc_command_executor.cpp
@@ -976,7 +976,7 @@ bool t_rpc_command_executor::print_transaction_pool_stats() {
}
else
{
- memset(&res.pool_stats, 0, sizeof(res.pool_stats));
+ res.pool_stats = {};
if (!m_rpc_server->on_get_transaction_pool_stats(req, res, false) || res.status != CORE_RPC_STATUS_OK)
{
tools::fail_msg_writer() << make_error(fail_message, res.status);
@@ -1895,7 +1895,7 @@ bool t_rpc_command_executor::sync_info()
for (const auto &s: res.spans)
if (s.rate > 0.0f && s.connection_id == p.info.connection_id)
nblocks += s.nblocks, size += s.size;
- tools::success_msg_writer() << address << " " << epee::string_tools::pad_string(p.info.peer_id, 16, '0', true) << " " << p.info.height << " " << p.info.current_download << " kB/s, " << nblocks << " blocks / " << size/1e6 << " MB queued";
+ tools::success_msg_writer() << address << " " << epee::string_tools::pad_string(p.info.peer_id, 16, '0', true) << " " << epee::string_tools::pad_string(p.info.state, 16) << " " << p.info.height << " " << p.info.current_download << " kB/s, " << nblocks << " blocks / " << size/1e6 << " MB queued";
}
uint64_t total_size = 0;