Changeset 13113


Ignore:
Timestamp:
Dec 22, 2011, 7:35:13 PM (9 years ago)
Author:
jordan
Message:

(trunk libT) #4684 "tr_cpSizeWhenDone() is slow for huge torrents that we're only partially downloading" -- fixed.

There are actually two different implementations of the byte-counting in that function: a slower implementation was added prior to 2.40 in r12918 to double-check the standard implementation. This checking was added to help smoke out a bug that was fixed in r12920, but I forgot to remove that slower implementation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/completion.c

    r12918 r13113  
    166166                else
    167167                {
    168                     uint64_t o = 0;
    169                     tr_block_index_t b, f, l;
     168                    tr_block_index_t f, l;
    170169                    tr_torGetPieceBlockRange( cp->tor, p, &f, &l );
    171                     for( b=f; b<=l; ++b )
    172                         if( tr_cpBlockIsComplete( cp, b ) )
    173                             n += tr_torBlockCountBytes( tor, b );
    174 
    175                     o = tr_bitfieldCountRange( &cp->blockBitfield, f, l+1 );
    176                     o *= cp->tor->blockSize;
     170
     171                    n = tr_bitfieldCountRange( &cp->blockBitfield, f, l+1 );
     172                    n *= cp->tor->blockSize;
    177173                    if( l == ( cp->tor->blockCount - 1 )  && tr_bitfieldHas( &cp->blockBitfield, l ) )
    178                         o -= ( cp->tor->blockSize - cp->tor->lastBlockSize );
    179 
    180                     assert( n == o );
     174                        n -= ( cp->tor->blockSize - cp->tor->lastBlockSize );
    181175                }
    182176
Note: See TracChangeset for help on using the changeset viewer.