Make daemon RPC client observe ip/port settings

This commit is contained in:
Zachary Michaels 2014-06-23 19:19:28 -04:00
parent 60a5ec4697
commit ec0a8d1339
3 changed files with 14 additions and 7 deletions

View File

@ -158,7 +158,10 @@ int main(int argc, char* argv[])
if (command_line::arg_present(vm, arg_command)) if (command_line::arg_present(vm, arg_command))
{ {
auto command = command_line::get_arg(vm, arg_command); auto command = command_line::get_arg(vm, arg_command);
auto args = t_rpc_command_executor::parse_host("127.0.0.1", "18081"); 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);
auto args = t_rpc_command_executor::parse_host(rpc_ip_str, rpc_port_str);
if (!args.ok) if (!args.ok)
{ {
std::cerr << "Invalid RPC host" << std::endl; std::cerr << "Invalid RPC host" << std::endl;

View File

@ -17,11 +17,8 @@ using namespace epee;
namespace cryptonote namespace cryptonote
{ {
namespace const command_line::arg_descriptor<std::string> core_rpc_server::arg_rpc_bind_ip = {"rpc-bind-ip", "", "127.0.0.1"};
{ const command_line::arg_descriptor<std::string> core_rpc_server::arg_rpc_bind_port = {"rpc-bind-port", "", std::to_string(RPC_DEFAULT_PORT)};
const command_line::arg_descriptor<std::string> arg_rpc_bind_ip = {"rpc-bind-ip", "", "127.0.0.1"};
const command_line::arg_descriptor<std::string> arg_rpc_bind_port = {"rpc-bind-port", "", std::to_string(RPC_DEFAULT_PORT)};
}
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
void core_rpc_server::init_options(boost::program_options::options_description& desc) void core_rpc_server::init_options(boost::program_options::options_description& desc)
@ -30,7 +27,11 @@ namespace cryptonote
command_line::add_arg(desc, arg_rpc_bind_port); command_line::add_arg(desc, arg_rpc_bind_port);
} }
//------------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------------
core_rpc_server::core_rpc_server(core& cr, nodetool::node_server<cryptonote::t_cryptonote_protocol_handler<cryptonote::core> >& p2p):m_core(cr), m_p2p(p2p) core_rpc_server::core_rpc_server(
core& cr, nodetool::node_server<cryptonote::t_cryptonote_protocol_handler<cryptonote::core> >& p2p
) :
m_core(cr)
, m_p2p(p2p)
{} {}
//------------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------------
bool core_rpc_server::handle_command_line(const boost::program_options::variables_map& vm) bool core_rpc_server::handle_command_line(const boost::program_options::variables_map& vm)

View File

@ -23,6 +23,9 @@ namespace cryptonote
public: public:
typedef epee::net_utils::connection_context_base connection_context; typedef epee::net_utils::connection_context_base connection_context;
static const command_line::arg_descriptor<std::string> arg_rpc_bind_ip;
static const command_line::arg_descriptor<std::string> arg_rpc_bind_port;
core_rpc_server(core& cr, nodetool::node_server<cryptonote::t_cryptonote_protocol_handler<cryptonote::core> >& p2p); core_rpc_server(core& cr, nodetool::node_server<cryptonote::t_cryptonote_protocol_handler<cryptonote::core> >& p2p);
static void init_options(boost::program_options::options_description& desc); static void init_options(boost::program_options::options_description& desc);