aboutsummaryrefslogtreecommitdiff
path: root/net.cpp
diff options
context:
space:
mode:
authors_nakamoto <s_nakamoto@1a98c847-1fd6-4fd8-948a-caf3550aa51b>2010-02-12 20:38:44 +0000
committers_nakamoto <s_nakamoto@1a98c847-1fd6-4fd8-948a-caf3550aa51b>2010-02-12 20:38:44 +0000
commit98500d70a8cf25af4bab80526fd128ccdc36ceeb (patch)
tree61624e0903150505dc09977ae9ff1bc9ab40ee2b /net.cpp
parentfa9dbd6b62ab161c29c9b8cf97b9c8da8ef4346e (diff)
command line and JSON-RPC first draft, requires Boost 1.35 or higher for boost::asio,
added SetBitcoinAddress and GetBitcoinAddress methods on CScript, critsect interlocks around mapAddressBook, added some random delays in tx broadcast to improve privacy, now compiles with MSVC 8.0 git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@60 1a98c847-1fd6-4fd8-948a-caf3550aa51b
Diffstat (limited to 'net.cpp')
-rw-r--r--net.cpp15
1 files changed, 5 insertions, 10 deletions
diff --git a/net.cpp b/net.cpp
index 38d05de1ab..ada78eb366 100644
--- a/net.cpp
+++ b/net.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 Satoshi Nakamoto
+// Copyright (c) 2009-2010 Satoshi Nakamoto
// Distributed under the MIT/X11 software license, see the accompanying
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
@@ -522,7 +522,6 @@ void CNode::Cleanup()
void ThreadSocketHandler(void* parg)
{
IMPLEMENT_RANDOMIZE_STACK(ThreadSocketHandler(parg));
-
try
{
vnThreadsRunning[0]++;
@@ -536,7 +535,6 @@ void ThreadSocketHandler(void* parg)
vnThreadsRunning[0]--;
throw; // support pthread_cancel()
}
-
printf("ThreadSocketHandler exiting\n");
}
@@ -816,7 +814,6 @@ void ThreadSocketHandler2(void* parg)
void ThreadOpenConnections(void* parg)
{
IMPLEMENT_RANDOMIZE_STACK(ThreadOpenConnections(parg));
-
try
{
vnThreadsRunning[1]++;
@@ -830,7 +827,6 @@ void ThreadOpenConnections(void* parg)
vnThreadsRunning[1]--;
PrintException(NULL, "ThreadOpenConnections()");
}
-
printf("ThreadOpenConnections exiting\n");
}
@@ -928,7 +924,7 @@ void ThreadOpenConnections2(void* parg)
// 30 days 27 hours
// 90 days 46 hours
// 365 days 93 hours
- int64 nDelay = (int64)(3600.0 * sqrt(fabs(nSinceLastSeen) / 3600.0) + nRandomizer);
+ int64 nDelay = (int64)(3600.0 * sqrt(fabs((double)nSinceLastSeen) / 3600.0) + nRandomizer);
// Fast reconnect for one hour after last seen
if (nSinceLastSeen < 60 * 60)
@@ -1016,7 +1012,6 @@ bool OpenNetworkConnection(const CAddress& addrConnect)
void ThreadMessageHandler(void* parg)
{
IMPLEMENT_RANDOMIZE_STACK(ThreadMessageHandler(parg));
-
try
{
vnThreadsRunning[2]++;
@@ -1030,7 +1025,6 @@ void ThreadMessageHandler(void* parg)
vnThreadsRunning[2]--;
PrintException(NULL, "ThreadMessageHandler()");
}
-
printf("ThreadMessageHandler exiting\n");
}
@@ -1329,7 +1323,7 @@ bool StopNode()
fShutdown = true;
nTransactionsUpdated++;
int64 nStart = GetTime();
- while (vnThreadsRunning[0] > 0 || vnThreadsRunning[2] > 0 || vnThreadsRunning[3] > 0)
+ while (vnThreadsRunning[0] > 0 || vnThreadsRunning[2] > 0 || vnThreadsRunning[3] > 0 || vnThreadsRunning[4] > 0)
{
if (GetTime() - nStart > 20)
break;
@@ -1339,7 +1333,8 @@ bool StopNode()
if (vnThreadsRunning[1] > 0) printf("ThreadOpenConnections still running\n");
if (vnThreadsRunning[2] > 0) printf("ThreadMessageHandler still running\n");
if (vnThreadsRunning[3] > 0) printf("ThreadBitcoinMiner still running\n");
- while (vnThreadsRunning[2] > 0)
+ if (vnThreadsRunning[4] > 0) printf("ThreadRPCServer still running\n");
+ while (vnThreadsRunning[2] > 0 || vnThreadsRunning[4] > 0)
Sleep(20);
Sleep(50);