Changeset 5587


Ignore:
Timestamp:
Apr 11, 2008, 11:05:14 PM (14 years ago)
Author:
charles
Message:

update a couple of the tr_stat fields based on feedback from BMW

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/torrent-cell-renderer.c

    r5539 r5587  
    5353                  _("%1$s of %2$s (%3$.2f%%)"),
    5454                  tr_strlsize( buf1, haveTotal, sizeof(buf1) ),
    55                   tr_strlsize( buf2, torStat->desiredSize, sizeof(buf2) ),
     55                  tr_strlsize( buf2, torStat->sizeWhenDone, sizeof(buf2) ),
    5656                  torStat->percentDone * 100.0 );
    5757    else if( !isSeed )
  • trunk/libtransmission/peer-mgr.c

    r5485 r5587  
    14181418}
    14191419
    1420 /* Returns the pieces that we and/or a connected peer has */
     1420/* Returns the pieces that are available from peers */
    14211421tr_bitfield*
    14221422tr_peerMgrGetAvailable( const tr_peerMgr * manager,
     
    14241424{
    14251425    int i, size;
    1426     const Torrent * t;
    1427     const tr_peer ** peers;
     1426    Torrent * t;
     1427    tr_peer ** peers;
    14281428    tr_bitfield * pieces;
    1429 
    14301429    managerLock( (tr_peerMgr*)manager );
    14311430
    14321431    t = getExistingTorrent( (tr_peerMgr*)manager, torrentHash );
    1433     peers = (const tr_peer **) tr_ptrArrayPeek( t->peers, &size );
    1434     pieces = tr_bitfieldDup( tr_cpPieceBitfield( t->tor->completion ) );
     1432    pieces = tr_bitfieldNew( t->tor->info.pieceCount );
     1433    peers = getConnectedPeers( t, &size );
    14351434    for( i=0; i<size; ++i )
    1436         if( peers[i]->io != NULL )
    1437             tr_bitfieldOr( pieces, peers[i]->have );
     1435        tr_bitfieldOr( pieces, peers[i]->have );
    14381436
    14391437    managerUnlock( (tr_peerMgr*)manager );
     1438    tr_free( peers );
    14401439    return pieces;
    14411440}
  • trunk/libtransmission/torrent.c

    r5556 r5587  
    639639    {
    640640        tr_piece_index_t i;
    641         tr_bitfield * availablePieces = tr_peerMgrGetAvailable( tor->handle->peerMgr,
    642                                                                 tor->info.hash );
    643         s->desiredSize = 0;
     641        tr_bitfield * peerPieces = tr_peerMgrGetAvailable( tor->handle->peerMgr,
     642                                                           tor->info.hash );
     643        s->sizeWhenDone = 0;
    644644        s->desiredAvailable = 0;
    645645
    646646        for( i=0; i<tor->info.pieceCount; ++i ) {
    647647            if( !tor->info.pieces[i].dnd ) {
    648                 const uint64_t byteCount = tr_torPieceCountBytes( tor, i );
    649                 s->desiredSize += byteCount;
    650                 if( tr_bitfieldHas( availablePieces, i ) )
    651                     s->desiredAvailable += byteCount;
     648                s->sizeWhenDone += tor->info.pieceSize;
     649                if( tr_bitfieldHas( peerPieces, i ) )
     650                    s->desiredAvailable += tr_cpMissingBlocksInPiece( tor->completion, i );
    652651            }
    653652        }
    654653
    655         /* "availablePieces" can miss our unverified blocks... */
    656         if( s->desiredAvailable < s->haveValid + s->haveUnchecked )
    657             s->desiredAvailable = s->haveValid + s->haveUnchecked;
    658 
    659         tr_bitfieldFree( availablePieces );
    660     }
    661 
    662     if( s->desiredSize > s->desiredAvailable )
     654        s->desiredAvailable *= tor->blockSize;
     655        tr_bitfieldFree( peerPieces );
     656    }
     657
     658    if( s->leftUntilDone > s->desiredAvailable )
    663659        s->eta = TR_ETA_NOT_AVAIL;
    664660    else if( s->rateDownload < 0.1 )
  • trunk/libtransmission/transmission.h

    r5585 r5587  
    896896    uint64_t haveUnchecked;
    897897
    898     /* Byte count of all the non-DND piece data that either we already have,
    899      * or that a peer we're connected to has. [0...desiredSize] */
     898    /* Byte count of all the piece data we'll have downloaded when we're done.
     899     * whether or not we have it yet. [0...tr_info.totalSize] */
     900    uint64_t sizeWhenDone;
     901
     902    /* Byte count of all the piece data we want and don't have yet,
     903     * but that a connected peer does have. [0...sizeWhenDone] */
    900904    uint64_t desiredAvailable;
    901 
    902     /* Byte count of all the piece data we want, whether we currently
    903      * have it nor not. [0...tr_info.totalSize] */
    904     uint64_t desiredSize;
    905905
    906906    float swarmspeed;
  • trunk/macosx/Torrent.m

    r5582 r5587  
    890890- (float) notAvailableDesired
    891891{
    892     return (float)(fStat->desiredSize - fStat->desiredAvailable) / [self size];
     892    return (float)(fStat->sizeWhenDone - fStat->desiredAvailable) / [self size];
    893893}
    894894
Note: See TracChangeset for help on using the changeset viewer.