Ignore:
Timestamp:
Oct 31, 2007, 4:23:51 AM (15 years ago)
Author:
charles
Message:

"corruption" fix part 2: lots of assertions, and try to complete pieces & ban bad peers sooner

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/peer-mgr.c

    r3659 r3663  
    545545{
    546546    tr_priority_t priority;
     547    int percentDone;
    547548    uint16_t random;
    548549    uint32_t piece;
     
    567568    if (a->priority != b->priority)
    568569        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;
    569574   
    570575    /* otherwise if one has fewer peers, it goes first */
     
    626631            setme->fastAllowed = 0;
    627632            setme->random = tr_rand( UINT16_MAX );
     633            setme->percentDone = (int)( 100.0 * tr_cpPercentBlocksInPiece( tor->completion, piece ) );
    628634
    629635            for( k=0; k<peerCount; ++k ) {
     
    638644        }
    639645
    640         qsort (p, poolSize, sizeof(struct tr_refill_piece), compareRefillPiece);
     646        qsort( p, poolSize, sizeof(struct tr_refill_piece), compareRefillPiece );
    641647
    642648        for( j=0; j<poolSize; ++j )
Note: See TracChangeset for help on using the changeset viewer.