aboutsummaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/int-util.h9
-rw-r--r--src/common/rpc_client.h16
2 files changed, 17 insertions, 8 deletions
diff --git a/src/common/int-util.h b/src/common/int-util.h
index 11e39895e..3bcc085e2 100644
--- a/src/common/int-util.h
+++ b/src/common/int-util.h
@@ -34,7 +34,10 @@
#include <stdbool.h>
#include <stdint.h>
#include <string.h>
+
+#ifndef _MSC_VER
#include <sys/param.h>
+#endif
#if defined(__ANDROID__)
#include <byteswap.h>
@@ -206,6 +209,12 @@ static inline void memcpy_swap64(void *dst, const void *src, size_t n) {
}
}
+#ifdef _MSC_VER
+# define LITTLE_ENDIAN 1234
+# define BIG_ENDIAN 4321
+# define BYTE_ORDER LITTLE_ENDIAN
+#endif
+
#if !defined(BYTE_ORDER) || !defined(LITTLE_ENDIAN) || !defined(BIG_ENDIAN)
static_assert(false, "BYTE_ORDER is undefined. Perhaps, GNU extensions are not enabled");
#endif
diff --git a/src/common/rpc_client.h b/src/common/rpc_client.h
index 64c84ed19..9665966ae 100644
--- a/src/common/rpc_client.h
+++ b/src/common/rpc_client.h
@@ -72,10 +72,10 @@ namespace tools
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());
+ 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() << "Daemon request failed";
+ fail_msg_writer() << "basic_json_rpc_request: Daemon request failed";
return false;
}
else
@@ -95,15 +95,15 @@ namespace tools
t_http_connection connection(&m_http_client);
bool ok = connection.is_open();
- 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: " << 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 ?
+ ok = epee::net_utils::invoke_http_json_rpc("/json_rpc", method_name, req, res, m_http_client, t_http_connection::TIMEOUT());
+ if (!ok || res.status != CORE_RPC_STATUS_OK) // TODO - handle CORE_RPC_STATUS_BUSY ?
{
- fail_msg_writer() << fail_msg << " -- " << res.status;
+ fail_msg_writer() << fail_msg << " -- json_rpc_request: " << res.status;
return false;
}
else
@@ -123,15 +123,15 @@ namespace tools
t_http_connection connection(&m_http_client);
bool ok = connection.is_open();
- 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: " << 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 ?
+ ok = epee::net_utils::invoke_http_json(relative_url, req, res, m_http_client, t_http_connection::TIMEOUT());
+ if (!ok || res.status != CORE_RPC_STATUS_OK) // TODO - handle CORE_RPC_STATUS_BUSY ?
{
- fail_msg_writer() << fail_msg << " -- " << res.status;
+ fail_msg_writer() << fail_msg << "-- rpc_request: " << res.status;
return false;
}
else