diff options
author | Riccardo Spagni <ric@spagni.net> | 2019-04-16 22:46:53 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2019-04-16 22:46:53 +0200 |
commit | c8ce4217cf2a8a3e91a5619c5a9d0e9bf877ce60 (patch) | |
tree | 2caf83a6b2e0c4f9ebee4163d4818f39b143f7b4 /src/wallet/wallet2.h | |
parent | Merge pull request #5446 (diff) | |
parent | wallet: new --offline option (diff) | |
download | monero-c8ce4217cf2a8a3e91a5619c5a9d0e9bf877ce60.tar.xz |
Merge pull request #5445
b18f0b10 wallet: new --offline option (moneromooo-monero)
Diffstat (limited to 'src/wallet/wallet2.h')
-rw-r--r-- | src/wallet/wallet2.h | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h index 032d2a663..8561c42ba 100644 --- a/src/wallet/wallet2.h +++ b/src/wallet/wallet2.h @@ -1232,19 +1232,22 @@ namespace tools template<class t_request, class t_response> inline bool invoke_http_json(const boost::string_ref uri, const t_request& req, t_response& res, std::chrono::milliseconds timeout = std::chrono::seconds(15), const boost::string_ref http_method = "GET") { - boost::lock_guard<boost::mutex> lock(m_daemon_rpc_mutex); + if (m_offline) return false; + boost::lock_guard<boost::recursive_mutex> lock(m_daemon_rpc_mutex); return epee::net_utils::invoke_http_json(uri, req, res, m_http_client, timeout, http_method); } template<class t_request, class t_response> inline bool invoke_http_bin(const boost::string_ref uri, const t_request& req, t_response& res, std::chrono::milliseconds timeout = std::chrono::seconds(15), const boost::string_ref http_method = "GET") { - boost::lock_guard<boost::mutex> lock(m_daemon_rpc_mutex); + if (m_offline) return false; + boost::lock_guard<boost::recursive_mutex> lock(m_daemon_rpc_mutex); return epee::net_utils::invoke_http_bin(uri, req, res, m_http_client, timeout, http_method); } template<class t_request, class t_response> inline bool invoke_http_json_rpc(const boost::string_ref uri, const std::string& method_name, const t_request& req, t_response& res, std::chrono::milliseconds timeout = std::chrono::seconds(15), const boost::string_ref http_method = "GET", const std::string& req_id = "0") { - boost::lock_guard<boost::mutex> lock(m_daemon_rpc_mutex); + if (m_offline) return false; + boost::lock_guard<boost::recursive_mutex> lock(m_daemon_rpc_mutex); return epee::net_utils::invoke_http_json_rpc(uri, method_name, req, res, m_http_client, timeout, http_method, req_id); } @@ -1291,6 +1294,7 @@ namespace tools uint64_t hash_m_transfers(int64_t transfer_height, crypto::hash &hash) const; void finish_rescan_bc_keep_key_images(uint64_t transfer_height, const crypto::hash &hash); void enable_dns(bool enable) { m_use_dns = enable; } + void set_offline(bool offline = true); private: /*! @@ -1422,7 +1426,7 @@ namespace tools std::atomic<bool> m_run; - boost::mutex m_daemon_rpc_mutex; + boost::recursive_mutex m_daemon_rpc_mutex; bool m_trusted_daemon; i_wallet2_callback* m_callback; @@ -1474,6 +1478,7 @@ namespace tools std::string m_device_derivation_path; uint64_t m_device_last_key_image_sync; bool m_use_dns; + bool m_offline; // Aux transaction data from device std::unordered_map<crypto::hash, std::string> m_tx_device; |