diff options
author | Antonio Juarez <antonio.maria.juarez@live.com> | 2014-03-20 11:46:11 +0000 |
---|---|---|
committer | Antonio Juarez <antonio.maria.juarez@live.com> | 2014-03-20 11:46:11 +0000 |
commit | 8efa1313f3614f34ac0bac947314bb53e9a2412b (patch) | |
tree | 2752f8e6dfbb75bc53d56ea422482a8ec5870ffa /src/daemon/daemon_commands_handler.h | |
parent | moved all stuff to github (diff) | |
download | monero-8efa1313f3614f34ac0bac947314bb53e9a2412b.tar.xz |
some fixes
Diffstat (limited to '')
-rw-r--r-- | src/daemon/daemon_commands_handler.h | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/src/daemon/daemon_commands_handler.h b/src/daemon/daemon_commands_handler.h index 2edd5d414..7695508c9 100644 --- a/src/daemon/daemon_commands_handler.h +++ b/src/daemon/daemon_commands_handler.h @@ -38,10 +38,15 @@ public: bool start_handling() { - m_cmd_binder.start_handling(&m_srv, ""); + m_cmd_binder.start_handling(&m_srv, "", ""); return true; } + void stop_handling() + { + m_cmd_binder.stop_handling(); + } + private: epee::srv_console_handlers_binder<nodetool::node_server<cryptonote::t_cryptonote_protocol_handler<cryptonote::core> > > m_cmd_binder; @@ -77,7 +82,13 @@ private: //-------------------------------------------------------------------------------- bool show_hr(const std::vector<std::string>& args) { - m_srv.get_payload_object().get_core().get_miner().do_print_hashrate(true); + if(!m_srv.get_payload_object().get_core().get_miner().is_mining()) + { + std::cout << "Mining is not started. You need start mining before you can see hash rate." << ENDL; + } else + { + m_srv.get_payload_object().get_core().get_miner().do_print_hashrate(true); + } return true; } //-------------------------------------------------------------------------------- @@ -100,7 +111,7 @@ private: //-------------------------------------------------------------------------------- bool print_cn(const std::vector<std::string>& args) { - m_srv.log_connections(); + m_srv.get_payload_object().log_connections(); return true; } //-------------------------------------------------------------------------------- @@ -263,7 +274,7 @@ private: { if(!args.size()) { - std::cout << "target account address for mining is not set" << std::endl; + std::cout << "Please, specify wallet address to mine for: start_mining <addr> [threads=1]" << std::endl; return true; } @@ -273,10 +284,11 @@ private: std::cout << "target account address has wrong format" << std::endl; return true; } - size_t threads_count = 1; + size_t threads_count = 1; if(args.size() > 1) { - string_tools::get_xtype_from_string(threads_count, args[1]); + bool ok = string_tools::get_xtype_from_string(threads_count, args[1]); + threads_count = (ok && 0 < threads_count) ? threads_count : 1; } m_srv.get_payload_object().get_core().get_miner().start(adr, threads_count); |