diff options
author | Luke Dashjr <luke-jr+git@utopios.org> | 2012-03-03 13:59:19 -0500 |
---|---|---|
committer | Luke Dashjr <luke-jr+git@utopios.org> | 2012-03-03 13:59:19 -0500 |
commit | 7013cc3d9710c0a03f6587c854e4e50c358ea70c (patch) | |
tree | 35e3c2ff533126be6d8d495eb6cf33d62b609014 /src/bitcoinrpc.cpp | |
parent | ef48e9b7dfde66368c27ed34f5f42de1b8e781f9 (diff) | |
parent | 88aa771536014919e955c4f7b2cada9a0dcf8561 (diff) | |
download | bitcoin-7013cc3d9710c0a03f6587c854e4e50c358ea70c.tar.xz |
Merge branch '0.4.x' into 0.5.0.x
Diffstat (limited to 'src/bitcoinrpc.cpp')
-rw-r--r-- | src/bitcoinrpc.cpp | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/src/bitcoinrpc.cpp b/src/bitcoinrpc.cpp index a09d7c7a49..02a2f8cdde 100644 --- a/src/bitcoinrpc.cpp +++ b/src/bitcoinrpc.cpp @@ -314,7 +314,7 @@ Value getinfo(const Array& params, bool fHelp) obj.push_back(Pair("keypoolsize", pwalletMain->GetKeyPoolSize())); obj.push_back(Pair("paytxfee", ValueFromAmount(nTransactionFee))); if (pwalletMain->IsCrypted()) - obj.push_back(Pair("unlocked_until", (boost::int64_t)nWalletUnlockTime)); + obj.push_back(Pair("unlocked_until", (boost::int64_t)nWalletUnlockTime / 1000)); obj.push_back(Pair("errors", GetWarnings("statusbar"))); return obj; } @@ -1403,7 +1403,7 @@ void ThreadTopUpKeyPool(void* parg) void ThreadCleanWalletPassphrase(void* parg) { - int64 nMyWakeTime = GetTime() + *((int*)parg); + int64 nMyWakeTime = GetTimeMillis() + *((int*)parg) * 1000; ENTER_CRITICAL_SECTION(cs_nWalletUnlockTime); @@ -1411,17 +1411,25 @@ void ThreadCleanWalletPassphrase(void* parg) { nWalletUnlockTime = nMyWakeTime; - while (GetTime() < nWalletUnlockTime) + do { - int64 nToSleep = GetTime() - nWalletUnlockTime; + if (nWalletUnlockTime==0) + break; + int64 nToSleep = nWalletUnlockTime - GetTimeMillis(); + if (nToSleep <= 0) + break; LEAVE_CRITICAL_SECTION(cs_nWalletUnlockTime); Sleep(nToSleep); ENTER_CRITICAL_SECTION(cs_nWalletUnlockTime); - } - nWalletUnlockTime = 0; - pwalletMain->Lock(); + } while(1); + + if (nWalletUnlockTime) + { + nWalletUnlockTime = 0; + pwalletMain->Lock(); + } } else { @@ -1519,9 +1527,9 @@ Value walletlock(const Array& params, bool fHelp) if (!pwalletMain->IsCrypted()) throw JSONRPCError(-15, "Error: running with an unencrypted wallet, but walletlock was called."); - pwalletMain->Lock(); CRITICAL_BLOCK(cs_nWalletUnlockTime) { + pwalletMain->Lock(); nWalletUnlockTime = 0; } |