aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Dashjr <luke-jr+git@utopios.org>2012-03-11 22:20:31 -0400
committerLuke Dashjr <luke-jr+git@utopios.org>2012-03-11 22:20:31 -0400
commitb4f8c8f5f9ff0f8db6612d7f279976453b18876f (patch)
tree0335a682102647221898ef22d70edf6fb4532418
parentb3b4b008e39ed77e5c579fa0ca179fe785ee5e79 (diff)
parent11c34e0f6cf9cb2715c28b85a1ec8f47bf5ca8dd (diff)
Merge branch '0.4.x' into 0.5.0.x
-rw-r--r--src/bitcoinrpc.cpp6
-rw-r--r--src/util.h4
2 files changed, 6 insertions, 4 deletions
diff --git a/src/bitcoinrpc.cpp b/src/bitcoinrpc.cpp
index 02a2f8cdde..36490e94f7 100644
--- a/src/bitcoinrpc.cpp
+++ b/src/bitcoinrpc.cpp
@@ -1403,7 +1403,7 @@ void ThreadTopUpKeyPool(void* parg)
void ThreadCleanWalletPassphrase(void* parg)
{
- int64 nMyWakeTime = GetTimeMillis() + *((int*)parg) * 1000;
+ int64 nMyWakeTime = GetTimeMillis() + *((int64*)parg) * 1000;
ENTER_CRITICAL_SECTION(cs_nWalletUnlockTime);
@@ -1439,7 +1439,7 @@ void ThreadCleanWalletPassphrase(void* parg)
LEAVE_CRITICAL_SECTION(cs_nWalletUnlockTime);
- delete (int*)parg;
+ delete (int64*)parg;
}
Value walletpassphrase(const Array& params, bool fHelp)
@@ -1474,7 +1474,7 @@ Value walletpassphrase(const Array& params, bool fHelp)
"Stores the wallet decryption key in memory for <timeout> seconds.");
CreateThread(ThreadTopUpKeyPool, NULL);
- int* pnSleepTime = new int(params[1].get_int());
+ int64* pnSleepTime = new int64(params[1].get_int64());
CreateThread(ThreadCleanWalletPassphrase, pnSleepTime);
return Value::null;
diff --git a/src/util.h b/src/util.h
index 19a291209a..34ccecac75 100644
--- a/src/util.h
+++ b/src/util.h
@@ -115,7 +115,9 @@ typedef u_int SOCKET;
#define Beep(n1,n2) (0)
inline void Sleep(int64 n)
{
- boost::thread::sleep(boost::get_system_time() + boost::posix_time::milliseconds(n));
+ /*Boost has a year 2038 problem— if the request sleep time is past epoch+2^31 seconds the sleep returns instantly.
+ So we clamp our sleeps here to 10 years and hope that boost is fixed by 2028.*/
+ boost::thread::sleep(boost::get_system_time() + boost::posix_time::milliseconds(n>315576000000LL?315576000000LL:n));
}
#endif