Changeset 5597


Ignore:
Timestamp:
Apr 12, 2008, 3:56:21 PM (14 years ago)
Author:
charles
Message:

minor tr_torrentStat cleanup

Location:
trunk/libtransmission
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/completion.c

    r5498 r5597  
    303303}
    304304
     305uint64_t
     306tr_cpSizeWhenDone( const tr_completion * cp )
     307{
     308    tr_cpEnsureDoneValid( cp );
     309
     310    return cp->doneTotal;
     311}
     312
    305313cp_status_t
    306314tr_cpGetStatus ( const tr_completion * cp )
  • trunk/libtransmission/completion.h

    r5329 r5597  
    4141uint64_t         tr_cpLeftUntilComplete( const tr_completion * );
    4242uint64_t         tr_cpLeftUntilDone( const tr_completion * );
     43uint64_t         tr_cpSizeWhenDone( const tr_completion * );
    4344float            tr_cpPercentComplete( const tr_completion * );
    4445float            tr_cpPercentDone( const tr_completion * );
  • trunk/libtransmission/torrent.c

    r5587 r5597  
    614614    s->percentDone = tr_cpPercentDone( tor->completion );
    615615    s->leftUntilDone = tr_cpLeftUntilDone( tor->completion );
     616    s->sizeWhenDone = tr_cpSizeWhenDone( tor->completion );
    616617
    617618    s->recheckProgress =
     
    641642        tr_bitfield * peerPieces = tr_peerMgrGetAvailable( tor->handle->peerMgr,
    642643                                                           tor->info.hash );
    643         s->sizeWhenDone = 0;
    644644        s->desiredAvailable = 0;
    645 
    646         for( i=0; i<tor->info.pieceCount; ++i ) {
    647             if( !tor->info.pieces[i].dnd ) {
    648                 s->sizeWhenDone += tor->info.pieceSize;
    649                 if( tr_bitfieldHas( peerPieces, i ) )
    650                     s->desiredAvailable += tr_cpMissingBlocksInPiece( tor->completion, i );
    651             }
    652         }
    653 
     645        for( i=0; i<tor->info.pieceCount; ++i )
     646            if( !tor->info.pieces[i].dnd && tr_bitfieldHas( peerPieces, i ) )
     647                s->desiredAvailable += tr_cpMissingBlocksInPiece( tor->completion, i );
    654648        s->desiredAvailable *= tor->blockSize;
    655649        tr_bitfieldFree( peerPieces );
  • trunk/libtransmission/transmission.h

    r5588 r5597  
    877877    time_t manualAnnounceTime;
    878878
     879    /* Byte count of all the piece data we'll have downloaded when we're done.
     880     * whether or not we have it yet. [0...tr_info.totalSize] */
     881    uint64_t sizeWhenDone;
     882
    879883    /* Byte count of how much data is left to be downloaded until
    880      * we're done -- that is, until we've got all the pieces we wanted. */
     884     * we're done -- that is, until we've got all the pieces we wanted.
     885     * [0...tr_info.sizeWhenDone] */
    881886    uint64_t leftUntilDone;
     887
     888    /* Byte count of all the piece data we want and don't have yet,
     889     * but that a connected peer does have. [0...leftUntilDone] */
     890    uint64_t desiredAvailable;
    882891
    883892    /* Byte count of all the corrupt data you've ever downloaded for
     
    901910     * moved to `corrupt' or `haveValid'. */
    902911    uint64_t haveUnchecked;
    903 
    904     /* Byte count of all the piece data we'll have downloaded when we're done.
    905      * whether or not we have it yet. [0...tr_info.totalSize] */
    906     uint64_t sizeWhenDone;
    907 
    908     /* Byte count of all the piece data we want and don't have yet,
    909      * but that a connected peer does have. [0...sizeWhenDone] */
    910     uint64_t desiredAvailable;
    911912
    912913    float swarmspeed;
Note: See TracChangeset for help on using the changeset viewer.