From 569b895cefb0ed0580e08620ed2cd02603feccb7 Mon Sep 17 00:00:00 2001 From: Jordan Lee Date: Wed, 9 Jan 2013 00:33:00 +0000 Subject: [PATCH] increase the per-peer prefetch count from 12 to 18. Add a symbolic constant for it. --- libtransmission/peer-msgs.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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))