1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-25 01:03:01 +00:00

tear out the "fast peer" code from refillPulse() altogether

This commit is contained in:
Charles Kerr 2008-02-25 01:35:20 +00:00
parent b9a9e1f1a8
commit f2f24e936d

View file

@ -568,8 +568,6 @@ struct tr_refill_piece
uint16_t random; uint16_t random;
uint32_t piece; uint32_t piece;
uint32_t peerCount; uint32_t peerCount;
uint32_t fastAllowed;
uint32_t suggested;
}; };
static int static int
@ -586,17 +584,6 @@ compareRefillPiece (const void * aIn, const void * bIn)
if( a->priority != b->priority ) if( a->priority != b->priority )
return a->priority > b->priority ? -1 : 1; return a->priority > b->priority ? -1 : 1;
/* if one *might be* fastallowed to us, get it first...
* I'm putting it on top so we prioritize those pieces at
* startup, then we'll have them, and we'll be denied access
* to them */
if (a->fastAllowed != b->fastAllowed)
return a->fastAllowed < b->fastAllowed ? -1 : 1;
/* otherwise if one was suggested to us, get it */
if (a->suggested != b->suggested)
return a->suggested < b->suggested ? -1 : 1;
/* otherwise if one has fewer peers, it goes first */ /* otherwise if one has fewer peers, it goes first */
if (a->peerCount != b->peerCount) if (a->peerCount != b->peerCount)
return a->peerCount < b->peerCount ? -1 : 1; return a->peerCount < b->peerCount ? -1 : 1;
@ -653,7 +640,6 @@ getPreferredPieces( Torrent * t,
setme->piece = piece; setme->piece = piece;
setme->priority = inf->pieces[piece].priority; setme->priority = inf->pieces[piece].priority;
setme->peerCount = 0; setme->peerCount = 0;
setme->fastAllowed = 0;
setme->random = tr_rand( UINT16_MAX ); setme->random = tr_rand( UINT16_MAX );
setme->missingBlockCount = tr_cpMissingBlocksInPiece( tor->completion, piece ); setme->missingBlockCount = tr_cpMissingBlocksInPiece( tor->completion, piece );
@ -661,16 +647,6 @@ getPreferredPieces( Torrent * t,
const tr_peer * peer = peers[k]; const tr_peer * peer = peers[k];
if( peer->peerIsInterested && !peer->clientIsChoked && tr_bitfieldHas( peer->have, piece ) ) if( peer->peerIsInterested && !peer->clientIsChoked && tr_bitfieldHas( peer->have, piece ) )
++setme->peerCount; ++setme->peerCount;
#if 0
/* FIXME: this code is too expensive! */
/* The fast peer extension doesn't force a peer to actually HAVE a fast-allowed piece,
but we're guaranteed to get the same pieces from different peers,
so we'll build a list and pray one actually have this one */
setme->fastAllowed = tr_peerMsgsIsPieceFastAllowed( peer->msgs, i );
/* Also, if someone SUGGESTed a piece to us, prioritize it over non-suggested others
*/
setme->suggested = tr_peerMsgsIsPieceSuggested( peer->msgs, i );
#endif
} }
} }