increase the per-peer prefetch count from 12 to 18. Add a symbolic constant for it.
This commit is contained in:
parent
1e9f6d44f9
commit
569b895cef
|
@ -86,6 +86,9 @@ enum
|
||||||
/* number of pieces we'll allow in our fast set */
|
/* number of pieces we'll allow in our fast set */
|
||||||
MAX_FAST_SET_SIZE = 3,
|
MAX_FAST_SET_SIZE = 3,
|
||||||
|
|
||||||
|
/* how many blocks to keep prefetched per peer */
|
||||||
|
PREFETCH_SIZE = 18,
|
||||||
|
|
||||||
/* defined in BEP #9 */
|
/* defined in BEP #9 */
|
||||||
METADATA_MSG_TYPE_REQUEST = 0,
|
METADATA_MSG_TYPE_REQUEST = 0,
|
||||||
METADATA_MSG_TYPE_DATA = 1,
|
METADATA_MSG_TYPE_DATA = 1,
|
||||||
|
@ -1198,8 +1201,7 @@ prefetchPieces (tr_peermsgs *msgs)
|
||||||
if (!getSession (msgs)->isPrefetchEnabled)
|
if (!getSession (msgs)->isPrefetchEnabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Maintain 12 prefetched blocks per unchoked peer */
|
for (i=msgs->prefetchCount; i<msgs->peer->pendingReqsToClient && i<PREFETCH_SIZE; ++i)
|
||||||
for (i=msgs->prefetchCount; i<msgs->peer->pendingReqsToClient && i<12; ++i)
|
|
||||||
{
|
{
|
||||||
const struct peer_request * req = msgs->peerAskedFor + i;
|
const struct peer_request * req = msgs->peerAskedFor + i;
|
||||||
if (requestIsValid (msgs, req))
|
if (requestIsValid (msgs, req))
|
||||||
|
|
Loading…
Reference in New Issue