increase the per-peer prefetch count from 12 to 18. Add a symbolic constant for it.

This commit is contained in:
Jordan Lee 2013-01-09 00:33:00 +00:00
parent 1e9f6d44f9
commit 569b895cef
1 changed files with 4 additions and 2 deletions

View File

@ -86,6 +86,9 @@ enum
/* number of pieces we'll allow in our fast set */
MAX_FAST_SET_SIZE = 3,
/* how many blocks to keep prefetched per peer */
PREFETCH_SIZE = 18,
/* defined in BEP #9 */
METADATA_MSG_TYPE_REQUEST = 0,
METADATA_MSG_TYPE_DATA = 1,
@ -1198,8 +1201,7 @@ prefetchPieces (tr_peermsgs *msgs)
if (!getSession (msgs)->isPrefetchEnabled)
return;
/* Maintain 12 prefetched blocks per unchoked peer */
for (i=msgs->prefetchCount; i<msgs->peer->pendingReqsToClient && i<12; ++i)
for (i=msgs->prefetchCount; i<msgs->peer->pendingReqsToClient && i<PREFETCH_SIZE; ++i)
{
const struct peer_request * req = msgs->peerAskedFor + i;
if (requestIsValid (msgs, req))