aboutsummaryrefslogtreecommitdiff
path: root/src/daemon/command_server.cpp
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2015-03-30 12:58:22 +0200
committerRiccardo Spagni <ric@spagni.net>2015-03-30 13:02:02 +0200
commitb0151de60144ddc1f56d253e7574bd6a9aefa28f (patch)
tree4e87da719ff11ccfa61798f3bd07d42574cc9c22 /src/daemon/command_server.cpp
parentMerge pull request #247 (diff)
parentRestore daemon interactive mode (diff)
downloadmonero-b0151de60144ddc1f56d253e7574bd6a9aefa28f.tar.xz
Merge pull request #248
a0590d2 Restore daemon interactive mode (Thomas Winget)
Diffstat (limited to 'src/daemon/command_server.cpp')
-rw-r--r--src/daemon/command_server.cpp31
1 files changed, 30 insertions, 1 deletions
diff --git a/src/daemon/command_server.cpp b/src/daemon/command_server.cpp
index bedceffed..601b12d57 100644
--- a/src/daemon/command_server.cpp
+++ b/src/daemon/command_server.cpp
@@ -37,11 +37,19 @@ namespace p = std::placeholders;
t_command_server::t_command_server(
uint32_t ip
, uint16_t port
+ , bool is_rpc
+ , cryptonote::core_rpc_server* rpc_server
)
- : m_parser(ip, port)
+ : m_parser(ip, port, is_rpc, rpc_server)
, m_command_lookup()
+ , m_is_rpc(is_rpc)
{
m_command_lookup.set_handler(
+ "q"
+ , [] (const std::vector<std::string>& args) {return true;}
+ , "ignored"
+ );
+ m_command_lookup.set_handler(
"help"
, std::bind(&t_command_server::help, this, p::_1)
, "Show this help"
@@ -127,6 +135,11 @@ t_command_server::t_command_server(
, "Stop the daemon"
);
m_command_lookup.set_handler(
+ "exit"
+ , std::bind(&t_command_parser_executor::stop_daemon, &m_parser, p::_1)
+ , "Stop the daemon"
+ );
+ m_command_lookup.set_handler(
"print_status"
, std::bind(&t_command_parser_executor::print_status, &m_parser, p::_1)
, "Prints daemon status"
@@ -163,6 +176,22 @@ bool t_command_server::process_command_vec(const std::vector<std::string>& cmd)
return result;
}
+bool t_command_server::start_handling()
+{
+ if (m_is_rpc) return false;
+
+ m_command_lookup.start_handling("", get_commands_str());
+
+ return true;
+}
+
+void t_command_server::stop_handling()
+{
+ if (m_is_rpc) return;
+
+ m_command_lookup.stop_handling();
+}
+
bool t_command_server::help(const std::vector<std::string>& args)
{
std::cout << get_commands_str() << std::endl;