diff --git a/libtransmission/peer-msgs.c b/libtransmission/peer-msgs.c index b15aac73b..f62d3a91f 100644 --- a/libtransmission/peer-msgs.c +++ b/libtransmission/peer-msgs.c @@ -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; ipeer->pendingReqsToClient && i<12; ++i) + for (i=msgs->prefetchCount; ipeer->pendingReqsToClient && ipeerAskedFor + i; if (requestIsValid (msgs, req))