Changeset 7891


Ignore:
Timestamp:
Feb 14, 2009, 5:15:23 AM (13 years ago)
Author:
livings124
Message:

eta will now indicate time remaining to reach seed ratio when seeding

Location:
trunk/libtransmission
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/torrent.c

    r7888 r7891  
    802802    int                     usableSeeds = 0;
    803803    uint64_t                now;
     804    double                  downloadedForRatio, seedRatio;
    804805
    805806    if( !tor )
     
    871872    s->haveUnchecked   = tr_cpHaveTotal( &tor->completion ) - s->haveValid;
    872873
    873 
    874874    if( usableSeeds > 0 )
    875875    {
     
    892892    }
    893893
    894     if( s->leftUntilDone > s->desiredAvailable )
    895         s->eta = TR_ETA_NOT_AVAIL;
    896     else if( s->pieceDownloadSpeed < 0.1 )
    897         s->eta = TR_ETA_UNKNOWN;
    898     else
    899         s->eta = s->leftUntilDone / s->pieceDownloadSpeed / 1024.0;
    900 
    901     s->ratio = tr_getRatio(
    902         s->uploadedEver,
    903         s->downloadedEver ? s->downloadedEver : s->
    904         haveValid );
     894    downloadedForRatio = s->downloadedEver ? s->downloadedEver : s->haveValid;
     895    s->ratio = tr_getRatio( s->uploadedEver, downloadedForRatio );
     896
     897    switch( s->activity )
     898    {
     899        case TR_STATUS_DOWNLOAD:
     900            if( s->leftUntilDone > s->desiredAvailable )
     901                s->eta = TR_ETA_NOT_AVAIL;
     902            else if( s->pieceDownloadSpeed < 0.1 )
     903                s->eta = TR_ETA_UNKNOWN;
     904            else
     905                s->eta = s->leftUntilDone / s->pieceDownloadSpeed / 1024.0;
     906            break;
     907       
     908        case TR_STATUS_SEED:
     909            if( tr_torrentGetSeedRatio( tor, &seedRatio ) )
     910            {
     911                if( s->pieceUploadSpeed < 0.1 )
     912                    s->eta = TR_ETA_UNKNOWN;
     913                else
     914                    s->eta = (downloadedForRatio * (seedRatio - s->ratio)) / s->pieceUploadSpeed / 1024.0;
     915            }
     916            else
     917                s->eta = TR_ETA_NOT_AVAIL;
     918            break;
     919       
     920        default:
     921            s->eta = TR_ETA_NOT_AVAIL;
     922            break;
     923    }
    905924
    906925    tr_torrentUnlock( tor );
  • trunk/libtransmission/transmission.h

    r7888 r7891  
    13321332#define TR_ETA_NOT_AVAIL -1
    13331333#define TR_ETA_UNKNOWN -2
    1334     /** Estimated number of seconds left until the torrent is done,
    1335         or TR_ETA_NOT_AVAIL or TR_ETA_UNKNOWN */
     1334    /** If downloading, estimated number of seconds left until the torrent is done.
     1335        If seeding, estimated number of seconds left until seed ratio is reached. */
    13361336    int    eta;
    13371337
Note: See TracChangeset for help on using the changeset viewer.