aboutsummaryrefslogtreecommitdiff
path: root/net.cpp
diff options
context:
space:
mode:
authors_nakamoto <s_nakamoto@1a98c847-1fd6-4fd8-948a-caf3550aa51b>2009-12-14 02:12:01 +0000
committers_nakamoto <s_nakamoto@1a98c847-1fd6-4fd8-948a-caf3550aa51b>2009-12-14 02:12:01 +0000
commite2c2648c14f4b87d331dbc30f0f2bd4aab9ce7e6 (patch)
tree338219ac575841c88b69060d6367b60364b7aae7 /net.cpp
parentadb50ffe32c5c37c84ff35d94bb486004e14a7cc (diff)
filter out duplicate getblocks and don't relay inv messages during initial block download -- 0.2 rc2v0.2rc2v0.2.0
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@49 1a98c847-1fd6-4fd8-948a-caf3550aa51b
Diffstat (limited to 'net.cpp')
-rw-r--r--net.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/net.cpp b/net.cpp
index 941e7c4dc9..168651ca2e 100644
--- a/net.cpp
+++ b/net.cpp
@@ -40,6 +40,23 @@ CAddress addrProxy("127.0.0.1:9050");
+
+
+void CNode::PushGetBlocks(CBlockIndex* pindexBegin, uint256 hashEnd)
+{
+ // Filter out duplicate requests
+ if (pindexBegin == pindexLastGetBlocksBegin && hashEnd == hashLastGetBlocksEnd)
+ return;
+ pindexLastGetBlocksBegin = pindexBegin;
+ hashLastGetBlocksEnd = hashEnd;
+
+ PushMessage("getblocks", CBlockLocator(pindexBegin), hashEnd);
+}
+
+
+
+
+
bool ConnectSocket(const CAddress& addrConnect, SOCKET& hSocketRet)
{
hSocketRet = INVALID_SOCKET;
@@ -764,12 +781,12 @@ void ThreadSocketHandler2(void* parg)
printf("socket no message in first 60 seconds, %d %d\n", pnode->nLastRecv != 0, pnode->nLastSend != 0);
pnode->fDisconnect = true;
}
- else if (GetTime() - pnode->nLastSend > 10 * 60 && GetTime() - pnode->nLastSendEmpty > 10 * 60)
+ else if (GetTime() - pnode->nLastSend > 90*60 && GetTime() - pnode->nLastSendEmpty > 90*60)
{
printf("socket not sending\n");
pnode->fDisconnect = true;
}
- else if (GetTime() - pnode->nLastRecv > (pnode->nVersion >= 107 ? 15*60 : 90*60))
+ else if (GetTime() - pnode->nLastRecv > 90*60)
{
printf("socket inactivity timeout\n");
pnode->fDisconnect = true;