Fix daemon rpc ip parsing

This commit is contained in:
Zachary Michaels 2014-07-03 11:17:10 -04:00
parent cd9644c8cb
commit 6f3f76b29e
3 changed files with 6 additions and 5 deletions

View File

@ -157,14 +157,14 @@ int main(int argc, char* argv[])
uint32_t rpc_ip; uint32_t rpc_ip;
uint16_t rpc_port; uint16_t rpc_port;
if (!epee::string_tools::get_xtype_from_string(rpc_ip, rpc_ip_str)) if (!epee::string_tools::get_ip_int32_from_string(rpc_ip, rpc_ip_str))
{ {
std::cerr << "Invalid IP" << std::endl; std::cerr << "Invalid IP: " << rpc_ip_str << std::endl;
return 1; return 1;
} }
if (!epee::string_tools::get_xtype_from_string(rpc_port, rpc_port_str)) if (!epee::string_tools::get_xtype_from_string(rpc_port, rpc_port_str))
{ {
std::cerr << "Invalid port" << std::endl; std::cerr << "Invalid port: " << rpc_port_str << std::endl;
return 1; return 1;
} }

View File

@ -1,5 +1,6 @@
#pragma once #pragma once
#include "string_tools.h"
#include "net/http_client.h" #include "net/http_client.h"
namespace daemonize { namespace daemonize {
@ -19,7 +20,7 @@ public:
: mp_http_client(p_http_client) : mp_http_client(p_http_client)
{ {
// TODO fix http client so that it accepts properly typed arguments // TODO fix http client so that it accepts properly typed arguments
std::string ip_str = boost::lexical_cast<std::string>(ip); std::string ip_str = epee::string_tools::get_ip_string_from_int32(ip);
std::string port_str = boost::lexical_cast<std::string>(port); std::string port_str = boost::lexical_cast<std::string>(port);
m_ok = mp_http_client->connect(ip_str, port_str, TIMEOUT); m_ok = mp_http_client->connect(ip_str, port_str, TIMEOUT);
} }

View File

@ -44,7 +44,7 @@ namespace {
{ {
std::string result = std::string result =
"http://" "http://"
+ boost::lexical_cast<std::string>(host) + epee::string_tools::get_ip_string_from_int32(host)
+ ":" + ":"
+ boost::lexical_cast<std::string>(port) + boost::lexical_cast<std::string>(port)
+ relative_url; + relative_url;