From b3b4b008e39ed77e5c579fa0ca179fe785ee5e79 Mon Sep 17 00:00:00 2001 From: nomnombtc Date: Mon, 5 Mar 2012 19:33:24 +0100 Subject: fix typo src/net.cpp --- src/net.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/net.cpp b/src/net.cpp index b314405efc..f37c675ff9 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -953,7 +953,7 @@ void ThreadSocketHandler2(void* parg) } else if (CNode::IsBanned(addr.ip)) { - printf("connetion from %s dropped (banned)\n", addr.ToString().c_str()); + printf("connection from %s dropped (banned)\n", addr.ToString().c_str()); closesocket(hSocket); } else -- cgit v1.2.3 From 11c34e0f6cf9cb2715c28b85a1ec8f47bf5ca8dd Mon Sep 17 00:00:00 2001 From: Gregory Maxwell Date: Sat, 10 Mar 2012 16:05:28 -0500 Subject: Resolves issue #922 - "wallet passphrase timeout of several years doesn't work" 2^31 milliseconds is only about 25 days. Also clamps Sleep() to 10 years, because it currently sleeps for 0 seconds when the sleep time would cross 2^31 seconds since the epoch. Hopefully boost will be fixed by 2028. --- src/rpc.cpp | 6 +++--- src/util.h | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/rpc.cpp b/src/rpc.cpp index da3384e398..8967b2c996 100644 --- a/src/rpc.cpp +++ b/src/rpc.cpp @@ -1277,7 +1277,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); @@ -1313,7 +1313,7 @@ void ThreadCleanWalletPassphrase(void* parg) LEAVE_CRITICAL_SECTION(cs_nWalletUnlockTime); - delete (int*)parg; + delete (int64*)parg; } Value walletpassphrase(const Array& params, bool fHelp) @@ -1353,7 +1353,7 @@ Value walletpassphrase(const Array& params, bool fHelp) "Stores the wallet decryption key in memory for 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 c4ee19fe01..4e4cbb9f60 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 -- cgit v1.2.3