aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2017-08-25 00:17:02 +0200
committerRiccardo Spagni <ric@spagni.net>2017-08-25 00:17:02 +0200
commit65ee63e5bf2e331a27965f9419fbb914e5052ab8 (patch)
tree8a366eb40d62fe7a60260dd4b0965f1c2e78c400
parentMerge pull request #2306 (diff)
parentrpc_client: print destination host/port when failing to connect (diff)
downloadmonero-65ee63e5bf2e331a27965f9419fbb914e5052ab8.tar.xz
Merge pull request #2326
64ab8844 rpc_client: print destination host/port when failing to connect (moneromooo-monero) 333f7012 http_client: add getters for host and port (moneromooo-monero)
-rw-r--r--contrib/epee/include/net/http_client.h3
-rw-r--r--src/common/rpc_client.h6
2 files changed, 6 insertions, 3 deletions
diff --git a/contrib/epee/include/net/http_client.h b/contrib/epee/include/net/http_client.h
index 67e63f7bf..8e099e2bc 100644
--- a/contrib/epee/include/net/http_client.h
+++ b/contrib/epee/include/net/http_client.h
@@ -293,6 +293,9 @@ using namespace std;
, m_lock()
{}
+ const std::string &get_host() const { return m_host_buff; };
+ const std::string &get_port() const { return m_port; };
+
bool set_server(const std::string& address, boost::optional<login> user)
{
http::url_content parsed{};
diff --git a/src/common/rpc_client.h b/src/common/rpc_client.h
index 8494b4a60..297020ef2 100644
--- a/src/common/rpc_client.h
+++ b/src/common/rpc_client.h
@@ -69,7 +69,7 @@ namespace tools
bool ok = connection.is_open();
if (!ok)
{
- fail_msg_writer() << "Couldn't connect to daemon";
+ fail_msg_writer() << "Couldn't connect to daemon: " << m_http_client.get_host() << ":" << m_http_client.get_port();
return false;
}
ok = ok && epee::net_utils::invoke_http_json_rpc("/json_rpc", method_name, req, res, m_http_client, t_http_connection::TIMEOUT());
@@ -98,7 +98,7 @@ namespace tools
ok = ok && epee::net_utils::invoke_http_json_rpc("/json_rpc", method_name, req, res, m_http_client, t_http_connection::TIMEOUT());
if (!ok)
{
- fail_msg_writer() << "Couldn't connect to daemon";
+ fail_msg_writer() << "Couldn't connect to daemon: " << m_http_client.get_host() << ":" << m_http_client.get_port();
return false;
}
else if (res.status != CORE_RPC_STATUS_OK) // TODO - handle CORE_RPC_STATUS_BUSY ?
@@ -126,7 +126,7 @@ namespace tools
ok = ok && epee::net_utils::invoke_http_json(relative_url, req, res, m_http_client, t_http_connection::TIMEOUT());
if (!ok)
{
- fail_msg_writer() << "Couldn't connect to daemon";
+ fail_msg_writer() << "Couldn't connect to daemon: " << m_http_client.get_host() << ":" << m_http_client.get_port();
return false;
}
else if (res.status != CORE_RPC_STATUS_OK) // TODO - handle CORE_RPC_STATUS_BUSY ?