Changeset 10744
- Timestamp:
- Jun 13, 2010, 5:17:33 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/peer-mgr.c
r10725 r10744 3275 3275 tr_torrent * tor; 3276 3276 struct peer_atom * atom; 3277 tr_priority_t priority; 3278 tr_bool wasRecentlyStarted; 3277 3279 }; 3278 3280 … … 3300 3302 comparePeerCandidates( const void * va, const void * vb ) 3301 3303 { 3302 int i , ai, bi;3304 int i; 3303 3305 tr_bool af, bf; 3304 3306 const struct peer_candidate * a = va; … … 3316 3318 3317 3319 /* prefer peers belonging to a torrent of a higher priority */ 3318 ai = tr_torrentGetPriority( a->tor ); 3319 bi = tr_torrentGetPriority( b->tor ); 3320 if( ai != bi ) 3321 return ai > bi ? -1 : 1; 3320 if( a->priority != b->priority ) 3321 return a->priority > b->priority ? -1 : 1; 3322 3322 3323 3323 /* prefer recently-started torrents */ 3324 af = torrentWasRecentlyStarted( a->tor ); 3325 bf = torrentWasRecentlyStarted( a->tor ); 3326 if( af != bf ) 3327 return af ? -1 : 1; 3324 if( a->wasRecentlyStarted != b->wasRecentlyStarted ) 3325 return a->wasRecentlyStarted ? -1 : 1; 3328 3326 3329 3327 /* prefer peers that we might have a chance of uploading to */ … … 3397 3395 walk->atom = atom; 3398 3396 walk->salt = tr_cryptoWeakRandInt( 4096 ); 3397 walk->priority = tr_torrentGetPriority( tor ); 3398 walk->wasRecentlyStarted = torrentWasRecentlyStarted( tor ); 3399 3399 ++walk; 3400 3400 }
Note: See TracChangeset
for help on using the changeset viewer.