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.
This commit is contained in:
Thomas Winget
2015-03-27 08:01:30 -04:00
parent cd31ea9631
commit a0590d29cd
16 changed files with 512 additions and 162 deletions

View File

@@ -37,10 +37,18 @@ 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)
@@ -126,6 +134,11 @@ t_command_server::t_command_server(
, std::bind(&t_command_parser_executor::stop_daemon, &m_parser, p::_1)
, "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)
@@ -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;