diff options
author | Thomas Winget <tewinget@gmail.com> | 2015-02-05 04:11:20 -0500 |
---|---|---|
committer | Thomas Winget <tewinget@gmail.com> | 2015-02-24 00:44:36 -0500 |
commit | 96cbecffd7235c1cf7ff5717fabe2d94d3192736 (patch) | |
tree | 3d378804e59a0038f10baaaff1b2ccf8a356006d /src/daemon/main.cpp | |
parent | Daemonize changes pulled in -- daemon builds (diff) | |
download | monero-96cbecffd7235c1cf7ff5717fabe2d94d3192736.tar.xz |
RPC calls for background daemon added in
The RPC calls the daemon executable uses to talk to the running daemon
instance have mostly been added back in. Rate limiting has not been
added in upstream, but is on its way in a separate effort, so those
calls are still NOPed out.
Diffstat (limited to '')
-rw-r--r-- | src/daemon/main.cpp | 51 |
1 files changed, 27 insertions, 24 deletions
diff --git a/src/daemon/main.cpp b/src/daemon/main.cpp index a2b389292..2f95370c0 100644 --- a/src/daemon/main.cpp +++ b/src/daemon/main.cpp @@ -156,34 +156,37 @@ int main(int argc, char const * argv[]) po::notify(vm); // If there are positional options, we're running a daemon command - if (command_line::has_arg(vm, daemon_args::arg_command)) { auto command = command_line::get_arg(vm, daemon_args::arg_command); - auto rpc_ip_str = command_line::get_arg(vm, cryptonote::core_rpc_server::arg_rpc_bind_ip); - auto rpc_port_str = command_line::get_arg(vm, cryptonote::core_rpc_server::arg_rpc_bind_port); - uint32_t rpc_ip; - uint16_t rpc_port; - if (!epee::string_tools::get_ip_int32_from_string(rpc_ip, rpc_ip_str)) + if (command.size()) { - std::cerr << "Invalid IP: " << rpc_ip_str << std::endl; - return 1; - } - if (!epee::string_tools::get_xtype_from_string(rpc_port, rpc_port_str)) - { - std::cerr << "Invalid port: " << rpc_port_str << std::endl; - return 1; - } - - daemonize::t_command_server rpc_commands{rpc_ip, rpc_port}; - if (rpc_commands.process_command_vec(command)) - { - return 0; - } - else - { - std::cerr << "Unknown command" << std::endl; - return 1; + auto rpc_ip_str = command_line::get_arg(vm, cryptonote::core_rpc_server::arg_rpc_bind_ip); + auto rpc_port_str = command_line::get_arg(vm, cryptonote::core_rpc_server::arg_rpc_bind_port); + + uint32_t rpc_ip; + uint16_t rpc_port; + if (!epee::string_tools::get_ip_int32_from_string(rpc_ip, rpc_ip_str)) + { + std::cerr << "Invalid IP: " << rpc_ip_str << std::endl; + return 1; + } + if (!epee::string_tools::get_xtype_from_string(rpc_port, rpc_port_str)) + { + std::cerr << "Invalid port: " << rpc_port_str << std::endl; + return 1; + } + + daemonize::t_command_server rpc_commands{rpc_ip, rpc_port}; + if (rpc_commands.process_command_vec(command)) + { + return 0; + } + else + { + std::cerr << "Unknown command" << std::endl; + return 1; + } } } |