mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 06:58:57 +01:00
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.
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user