aboutsummaryrefslogtreecommitdiff
path: root/src/net.cpp
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2011-06-30 23:29:44 +0200
committerPieter Wuille <pieter.wuille@gmail.com>2011-07-01 09:39:44 +0200
commit497317453422611a077f7f195eb193d3bb597a9c (patch)
tree3063ec6de27084fd37a62d72bdefb8eee28558c7 /src/net.cpp
parent44d16327c19f033169171678e58bd779301e87d5 (diff)
Limit response to getblocks to half of output buffer size
Introduce SendBufferSize() and ReceiveBufferSize(), and limit the blocks sent as response to the "getblocks" message to half of the active send buffer size.
Diffstat (limited to 'src/net.cpp')
-rw-r--r--src/net.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/net.cpp b/src/net.cpp
index e4b02331e9..a0ec6dfadc 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -915,7 +915,7 @@ void ThreadSocketHandler2(void* parg)
CDataStream& vRecv = pnode->vRecv;
unsigned int nPos = vRecv.size();
- if (nPos > 1000*GetArg("-maxreceivebuffer", 10*1000)) {
+ if (nPos > ReceiveBufferSize()) {
if (!pnode->fDisconnect)
printf("socket recv flood control disconnect (%d bytes)\n", vRecv.size());
pnode->CloseSocketDisconnect();
@@ -980,7 +980,7 @@ void ThreadSocketHandler2(void* parg)
pnode->CloseSocketDisconnect();
}
}
- if (vSend.size() > 1000*GetArg("-maxsendbuffer", 10*1000)) {
+ if (vSend.size() > SendBufferSize()) {
if (!pnode->fDisconnect)
printf("socket send flood control disconnect (%d bytes)\n", vSend.size());
pnode->CloseSocketDisconnect();