Changeset 12101


Ignore:
Timestamp:
Mar 5, 2011, 3:51:57 AM (11 years ago)
Author:
jordan
Message:

(trunk libT) #4083 "Wrong shades of progress in Inspector pieces view." -- fixed.

The problem was reported by Rolcol and tracked down by livings124. It's flashing orange because the completion in "availability" doesn't match the completion in in "progress", which corresponds with tr_torrentAvailability() and tr_torrentAmountFinished(). tr_cpGetAmountDone() was recently reworked in r12012 for #4048, which caused the problem. Both functions need to sample the torrent using the same methodology so that their results can be used together.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/completion.c

    r12046 r12101  
    305305tr_cpGetAmountDone( const tr_completion * cp, float * tab, int tabCount )
    306306{
    307     int i, b;
    308     const int span = cp->tor->blockCount / tabCount;
    309 
    310     for( i=b=0; i<tabCount; ++i, b+=span )
    311         tab[i] = tr_bitsetCountRange(&cp->blockBitset,b,b+span) / (float)span;
     307    int i;
     308    const float interval = cp->tor->info.pieceCount / (float)tabCount;
     309    const tr_bool seed = isSeed( cp );
     310
     311    for( i=0; i<tabCount; ++i ) {
     312        if( seed )
     313            tab[i] = 1.0f;
     314        else {
     315            const tr_piece_index_t piece = (tr_piece_index_t)i * interval;
     316            tab[i] = getCompleteBlocks(cp)[piece] / (float)countBlocksInPiece( cp->tor, piece );
     317        }
     318    }
    312319}
    313320
Note: See TracChangeset for help on using the changeset viewer.