aboutsummaryrefslogtreecommitdiff
path: root/src/common/http_connection.h
diff options
context:
space:
mode:
authorLee Clagett <code@leeclagett.com>2017-01-25 00:16:05 -0500
committerLee Clagett <code@leeclagett.com>2017-01-25 15:39:32 -0500
commitc02e1cb943903d34becfaf1c6d9cd71e4424d748 (patch)
treea363ce155ba8f6b14a924c84380ec2886894f22d /src/common/http_connection.h
parentMerge pull request #1622 (diff)
downloadmonero-c02e1cb943903d34becfaf1c6d9cd71e4424d748.tar.xz
Updates to epee HTTP client code
- http_simple_client now uses std::chrono for timeouts - http_simple_client accepts timeouts per connect / invoke call - shortened names of epee http invoke functions - invoke command functions only take relative path, connection is not automatically performed
Diffstat (limited to 'src/common/http_connection.h')
-rw-r--r--src/common/http_connection.h17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/common/http_connection.h b/src/common/http_connection.h
index 156474cdd..8a786361a 100644
--- a/src/common/http_connection.h
+++ b/src/common/http_connection.h
@@ -28,6 +28,7 @@
#pragma once
+#include <chrono>
#include "string_tools.h"
#include "net/http_client.h"
@@ -38,20 +39,16 @@ private:
epee::net_utils::http::http_simple_client * mp_http_client;
bool m_ok;
public:
- static unsigned int const TIMEOUT = 200000;
+ static constexpr std::chrono::seconds TIMEOUT()
+ {
+ return std::chrono::minutes(3) + std::chrono::seconds(30);
+ }
- t_http_connection(
- epee::net_utils::http::http_simple_client * p_http_client
- , uint32_t ip
- , uint16_t port
- )
+ t_http_connection(epee::net_utils::http::http_simple_client* p_http_client)
: mp_http_client(p_http_client)
, m_ok(false)
{
- // TODO fix http client so that it accepts properly typed arguments
- std::string ip_str = epee::string_tools::get_ip_string_from_int32(ip);
- 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(TIMEOUT());
}
~t_http_connection()