Ignore:
Timestamp:
Mar 28, 2011, 4:31:05 PM (11 years ago)
Author:
jordan
Message:

(trunk libT) break the mac build and introduce new crashes.

This is partially to address #4145 "Downloads stuck at 100%" by refactoring the bitset, bitfield, and tr_completion; however, the ripple effect is larger than usual so things may get worse in the short term before getting better.

livings124: to fix the mac build, remove bitset.[ch] from xcode

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/torrent.c

    r12233 r12248  
    11391139{
    11401140    tr_stat *               s;
    1141     int                     usableSeeds;
    11421141    uint64_t                now;
    11431142    uint64_t                seedRatioBytesLeft;
     
    11641163    tr_peerMgrTorrentStats( tor,
    11651164                            &s->peersConnected,
    1166                             &usableSeeds,
    11671165                            &s->webseedsSendingToUs,
    11681166                            &s->peersSendingToUs,
     
    11751173    s->rawDownloadSpeed_KBps   = toSpeedKBps( tr_bandwidthGetRawSpeed_Bps  ( tor->bandwidth, now, TR_DOWN ) );
    11761174    s->pieceDownloadSpeed_KBps = toSpeedKBps( tr_bandwidthGetPieceSpeed_Bps( tor->bandwidth, now, TR_DOWN ) );
    1177 
    1178     usableSeeds += tor->info.webseedCount;
    11791175
    11801176    s->percentComplete = tr_cpPercentComplete ( &tor->completion );
     
    11971193        s->idleSecs = -1;
    11981194
    1199     s->corruptEver     = tor->corruptCur    + tor->corruptPrev;
    1200     s->downloadedEver  = tor->downloadedCur + tor->downloadedPrev;
    1201     s->uploadedEver    = tor->uploadedCur   + tor->uploadedPrev;
    1202     s->haveValid       = tr_cpHaveValid( &tor->completion );
    1203     s->haveUnchecked   = tr_cpHaveTotal( &tor->completion ) - s->haveValid;
    1204 
    1205     if( usableSeeds > 0 )
    1206     {
    1207         s->desiredAvailable = s->leftUntilDone;
    1208     }
    1209     else if( !s->leftUntilDone || !s->peersConnected )
    1210     {
    1211         s->desiredAvailable = 0;
    1212     }
    1213     else
    1214     {
    1215         tr_piece_index_t i;
    1216         tr_bitfield *    peerPieces = tr_peerMgrGetAvailable( tor );
    1217         s->desiredAvailable = 0;
    1218         for( i = 0; i < tor->info.pieceCount; ++i )
    1219             if( !tor->info.pieces[i].dnd && tr_bitfieldHasFast( peerPieces, i ) )
    1220                 s->desiredAvailable += tr_cpMissingBlocksInPiece( &tor->completion, i );
    1221         s->desiredAvailable *= tor->blockSize;
    1222         tr_bitfieldFree( peerPieces );
    1223     }
     1195    s->corruptEver      = tor->corruptCur    + tor->corruptPrev;
     1196    s->downloadedEver   = tor->downloadedCur + tor->downloadedPrev;
     1197    s->uploadedEver     = tor->uploadedCur   + tor->uploadedPrev;
     1198    s->haveValid        = tr_cpHaveValid( &tor->completion );
     1199    s->haveUnchecked    = tr_cpHaveTotal( &tor->completion ) - s->haveValid;
     1200    s->desiredAvailable = tr_peerMgrGetDesiredAvailable( tor );
    12241201
    12251202    s->ratio = tr_getRatio( s->uploadedEver,
     
    13281305            /* the middle blocks */
    13291306            if( first + 1 < last ) {
    1330                 uint64_t u = tr_bitsetCountRange( tr_cpBlockBitset( &tor->completion ), first+1, last );
     1307                uint64_t u = tr_bitfieldCountRange( &tor->completion.blockBitfield, first+1, last );
    13311308                u *= tor->blockSize;
    13321309                total += u;
Note: See TracChangeset for help on using the changeset viewer.