aboutsummaryrefslogtreecommitdiff
path: root/src/daemon/command_server.cpp
diff options
context:
space:
mode:
authorThomas Winget <tewinget@gmail.com>2015-03-27 08:01:30 -0400
committerThomas Winget <tewinget@gmail.com>2015-03-27 08:01:30 -0400
commita0590d29cd9949c65a4cd67630a84410a30d33fe (patch)
tree4e87da719ff11ccfa61798f3bd07d42574cc9c22 /src/daemon/command_server.cpp
parentMerge pull request #247 (diff)
downloadmonero-a0590d29cd9949c65a4cd67630a84410a30d33fe.tar.xz
Restore daemon interactive mode
Daemon interactive mode is now working again. RPC mapped calls in daemon and wallet have both had connection_context removed as an argument as that argument was not being used anywhere.
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;