Ignore:
Timestamp:
Apr 20, 2007, 11:51:15 PM (15 years ago)
Author:
livings124
Message:

expand the last commit a bit so that ratio is calculated with the actual downloaded amount if amount downloaded in T is 0. This should eliminate ever showing infinity for ratio.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/torrent.c

    r1766 r1767  
    462462    if( s->downloaded == 0 )
    463463    {
    464         //if seeding without ever downloading, calculate ratio from total size
    465         if( s->progress >= 1.0 )
    466         {
    467             s->ratio = (float)s->uploaded / (float)inf->totalSize;
     464        //if some is downloaded without a downloaded value, calculate ratio from total size
     465        if( s->progress > 0.0 )
     466        {
     467            s->ratio = (float)s->uploaded / ((float)inf->totalSize * s->progress);
    468468        }
    469469        else
    470470        {
    471             s->ratio = s->uploaded == 0 ? TR_RATIO_NA : TR_RATIO_INF;
     471            s->ratio = TR_RATIO_NA;
    472472        }
    473473    }
Note: See TracChangeset for help on using the changeset viewer.