Changeset 7988


Ignore:
Timestamp:
Mar 1, 2009, 11:48:04 PM (13 years ago)
Author:
livings124
Message:

move the percent to the stop ratio into libtransmission

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/torrent.c

    r7986 r7988  
    805805    uint64_t                now;
    806806    double                  downloadedForRatio, seedRatio;
     807    tr_bool                 checkSeedRatio;
    807808
    808809    if( !tor )
     
    862863                       : 0.0;
    863864
    864 
    865865    s->activityDate = tor->activityDate;
    866866    s->addedDate    = tor->addedDate;
     
    897897    s->ratio = tr_getRatio( s->uploadedEver, downloadedForRatio );
    898898
     899    checkSeedRatio = tr_torrentGetSeedRatio( tor, &seedRatio );
     900
    899901    switch( s->activity )
    900902    {
     
    909911
    910912        case TR_STATUS_SEED:
    911             if( tr_torrentGetSeedRatio( tor, &seedRatio ) )
     913            if( checkSeedRatio )
    912914            {
    913915                if( s->pieceUploadSpeed < 0.1 )
     
    924926            break;
    925927    }
     928
     929    if ( !checkSeedRatio || s->ratio >= seedRatio || s->ratio == TR_RATIO_INF )
     930        s->percentRatio = 1.0;
     931    else if ( s->ratio == TR_RATIO_NA )
     932        s->percentRatio = 0.0;
     933    else
     934        s->percentRatio = s->ratio / seedRatio;
    926935
    927936    tr_torrentUnlock( tor );
     
    21492158            if( tor->ratio_limit_hit_func != NULL )
    21502159                tor->ratio_limit_hit_func( tor, tor->ratio_limit_hit_func_user_data );
    2151 
    21522160        }
    21532161    }
  • trunk/libtransmission/transmission.h

    r7930 r7988  
    13151315        @see tr_stat.leftUntilDone */
    13161316    float    percentDone;
     1317   
     1318    /** The percentage of the actual ratio to the seed ratio.  This will be
     1319        equal to 1 if the ratio is reached or the torrent is set to seed forever.
     1320        Range is [0..1] */
     1321    float    percentRatio;
    13171322
    13181323    /** Speed all data being sent for this torrent. (KiB/s)
  • trunk/macosx/Torrent.m

    r7894 r7988  
    388388}
    389389
    390 #warning move to libtransmission
    391390- (CGFloat) progressStopRatio
    392391{
    393     double stopRatio, ratio;
    394     if (!tr_torrentGetSeedRatio(fHandle, &stopRatio) || (ratio = [self ratio]) >= stopRatio)
    395         return 1.0;
    396     else if (stopRatio > 0.0)
    397         return ratio / stopRatio;
    398     else
    399         return 0.0;
     392    return fStat->percentRatio;
    400393}
    401394
Note: See TracChangeset for help on using the changeset viewer.