Changeset 3663 for trunk/libtransmission/peer-mgr.c
- Timestamp:
- Oct 31, 2007, 4:23:51 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/peer-mgr.c
r3659 r3663 545 545 { 546 546 tr_priority_t priority; 547 int percentDone; 547 548 uint16_t random; 548 549 uint32_t piece; … … 567 568 if (a->priority != b->priority) 568 569 return a->priority > b->priority ? -1 : 1; 570 571 /* try to fill partial pieces */ 572 if( a->percentDone != b->percentDone ) 573 return a->percentDone > b->percentDone ? -1 : 1; 569 574 570 575 /* otherwise if one has fewer peers, it goes first */ … … 626 631 setme->fastAllowed = 0; 627 632 setme->random = tr_rand( UINT16_MAX ); 633 setme->percentDone = (int)( 100.0 * tr_cpPercentBlocksInPiece( tor->completion, piece ) ); 628 634 629 635 for( k=0; k<peerCount; ++k ) { … … 638 644 } 639 645 640 qsort (p, poolSize, sizeof(struct tr_refill_piece), compareRefillPiece);646 qsort( p, poolSize, sizeof(struct tr_refill_piece), compareRefillPiece ); 641 647 642 648 for( j=0; j<poolSize; ++j )
Note: See TracChangeset
for help on using the changeset viewer.