diff options
author | Ilya Kitaev <mbg033@gmail.com> | 2016-07-14 13:33:49 +0300 |
---|---|---|
committer | Ilya Kitaev <mbg033@gmail.com> | 2016-07-18 23:03:09 +0300 |
commit | d7597c5961ed1e8be8a7eca8c52e491b500797c6 (patch) | |
tree | e87958c772bf6c0f4828cc269e280b029e159515 /src/wallet/api/wallet.cpp | |
parent | wallet_api: async init, Wallet::connected status, log level (diff) | |
download | monero-d7597c5961ed1e8be8a7eca8c52e491b500797c6.tar.xz |
refreshing wallet even if error happened
Diffstat (limited to 'src/wallet/api/wallet.cpp')
-rw-r--r-- | src/wallet/api/wallet.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp index 2322cac76..67d2ebecb 100644 --- a/src/wallet/api/wallet.cpp +++ b/src/wallet/api/wallet.cpp @@ -643,7 +643,7 @@ void WalletImpl::refreshThreadFunc() LOG_PRINT_L3(__FUNCTION__ << ": refresh lock acquired..."); LOG_PRINT_L3(__FUNCTION__ << ": m_refreshEnabled: " << m_refreshEnabled); LOG_PRINT_L3(__FUNCTION__ << ": m_status: " << m_status); - if (m_refreshEnabled && m_status == Status_Ok) { + if (m_refreshEnabled /*&& m_status == Status_Ok*/) { LOG_PRINT_L3(__FUNCTION__ << ": refreshing..."); doRefresh(); } @@ -657,16 +657,16 @@ void WalletImpl::doRefresh() std::lock_guard<std::mutex> guarg(m_refreshMutex2); try { m_wallet->refresh(); - if (m_wallet2Callback->getListener()) { - m_wallet2Callback->getListener()->refreshed(); - } } catch (const std::exception &e) { m_status = Status_Error; m_errorString = e.what(); } + if (m_wallet2Callback->getListener()) { + m_wallet2Callback->getListener()->refreshed(); + } } -// supposed to be called from ctor only + void WalletImpl::startRefresh() { if (!m_refreshEnabled) { @@ -676,7 +676,7 @@ void WalletImpl::startRefresh() } -// supposed to be called from dtor only + void WalletImpl::stopRefresh() { if (!m_refreshThreadDone) { @@ -686,5 +686,13 @@ void WalletImpl::stopRefresh() } } +void WalletImpl::pauseRefresh() +{ + // TODO synchronize access + if (!m_refreshThreadDone) { + m_refreshEnabled = false; + } +} + } // namespace |