diff options
author | Jaquee <jaquee.monero@gmail.com> | 2017-01-14 14:41:56 +0100 |
---|---|---|
committer | Jaquee <jaquee.monero@gmail.com> | 2017-01-14 14:45:30 +0100 |
commit | dea53962a356259e5b82f3d7abbdd54772d29c71 (patch) | |
tree | 1e39e58e4840cc74de75511bec3ef55c01d789b4 /src/wallet/api/wallet.cpp | |
parent | Merge pull request #1562 (diff) | |
download | monero-dea53962a356259e5b82f3d7abbdd54772d29c71.tar.xz |
fix timeout in check_connection
Diffstat (limited to '')
-rw-r--r-- | src/wallet/api/wallet.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp index e8ae7c642..647859b5e 100644 --- a/src/wallet/api/wallet.cpp +++ b/src/wallet/api/wallet.cpp @@ -54,6 +54,8 @@ namespace { static const int MAX_REFRESH_INTERVAL_MILLIS = 1000 * 60 * 1; // Default refresh interval when connected to remote node static const int DEFAULT_REMOTE_NODE_REFRESH_INTERVAL_MILLIS = 1000 * 10; + // Connection timeout 30 sec + static const int DEFAULT_CONNECTION_TIMEOUT_MILLIS = 1000 * 30; } struct Wallet2CallbackImpl : public tools::i_wallet2_callback @@ -1043,7 +1045,7 @@ bool WalletImpl::verifySignedMessage(const std::string &message, const std::stri bool WalletImpl::connectToDaemon() { - bool result = m_wallet->check_connection(); + bool result = m_wallet->check_connection(NULL, DEFAULT_CONNECTION_TIMEOUT_MILLIS); m_status = result ? Status_Ok : Status_Error; if (!result) { m_errorString = "Error connecting to daemon at " + m_wallet->get_daemon_address(); @@ -1056,7 +1058,7 @@ bool WalletImpl::connectToDaemon() Wallet::ConnectionStatus WalletImpl::connected() const { uint32_t version = 0; - m_is_connected = m_wallet->check_connection(&version); + m_is_connected = m_wallet->check_connection(&version, DEFAULT_CONNECTION_TIMEOUT_MILLIS); if (!m_is_connected) return Wallet::ConnectionStatus_Disconnected; if ((version >> 16) != CORE_RPC_VERSION_MAJOR) |