aboutsummaryrefslogtreecommitdiff
path: root/contrib/epee
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2019-04-16 22:46:53 +0200
committerRiccardo Spagni <ric@spagni.net>2019-04-16 22:46:53 +0200
commitc8ce4217cf2a8a3e91a5619c5a9d0e9bf877ce60 (patch)
tree2caf83a6b2e0c4f9ebee4163d4818f39b143f7b4 /contrib/epee
parentMerge pull request #5446 (diff)
parentwallet: new --offline option (diff)
downloadmonero-c8ce4217cf2a8a3e91a5619c5a9d0e9bf877ce60.tar.xz
Merge pull request #5445
b18f0b10 wallet: new --offline option (moneromooo-monero)
Diffstat (limited to 'contrib/epee')
-rw-r--r--contrib/epee/include/net/http_client.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/contrib/epee/include/net/http_client.h b/contrib/epee/include/net/http_client.h
index bb10c8efc..588d5f0e3 100644
--- a/contrib/epee/include/net/http_client.h
+++ b/contrib/epee/include/net/http_client.h
@@ -274,6 +274,7 @@ namespace net_utils
reciev_machine_state m_state;
chunked_state m_chunked_state;
std::string m_chunked_cache;
+ bool m_auto_connect;
critical_section m_lock;
public:
@@ -291,6 +292,7 @@ namespace net_utils
, m_state()
, m_chunked_state()
, m_chunked_cache()
+ , m_auto_connect(true)
, m_lock()
{}
@@ -316,6 +318,11 @@ namespace net_utils
m_net_client.set_ssl(std::move(ssl_options));
}
+ void set_auto_connect(bool auto_connect)
+ {
+ m_auto_connect = auto_connect;
+ }
+
template<typename F>
void set_connector(F connector)
{
@@ -367,6 +374,11 @@ namespace net_utils
CRITICAL_REGION_LOCAL(m_lock);
if(!is_connected())
{
+ if (!m_auto_connect)
+ {
+ MWARNING("Auto connect attempt to " << m_host_buff << ":" << m_port << " disabled");
+ return false;
+ }
MDEBUG("Reconnecting...");
if(!connect(timeout))
{