Don't waste work on slow peers until they catch up

This commit is contained in:
Peter Todd 2013-08-21 12:30:32 -04:00 committed by Warren Togami
parent a42627b5ec
commit 218e2ea912

View File

@ -3068,6 +3068,12 @@ void static ProcessGetData(CNode* pfrom)
if (pfrom->nSendSize >= SendBufferSize()) if (pfrom->nSendSize >= SendBufferSize())
break; break;
// Don't waste work on slow peers until they catch up on the blocks we
// give them. 80 bytes is just the size of a block header - obviously
// the minimum we might return.
if (pfrom->nBlocksRequested * 80 > pfrom->nSendBytes)
break;
const CInv &inv = *it; const CInv &inv = *it;
{ {
boost::this_thread::interruption_point(); boost::this_thread::interruption_point();