Changeset 1769


Ignore:
Timestamp:
Apr 21, 2007, 6:38:37 AM (15 years ago)
Author:
livings124
Message:

determine ratio by using download amount as the larger of amount downloaded by T and percent times file size

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/torrent.c

    r1767 r1769  
    460460    s->uploaded   = tor->uploadedCur   + tor->uploadedPrev;
    461461   
    462     if( s->downloaded == 0 )
    463     {
    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);
    468         }
    469         else
    470         {
    471             s->ratio = TR_RATIO_NA;
    472         }
     462    if( s->downloaded == 0 && s->progress == 0.0 )
     463    {
     464        s->ratio = TR_RATIO_NA;
    473465    }
    474466    else
    475467    {
    476         s->ratio = (float)s->uploaded / (float)s->downloaded;
     468        s->ratio = (float)s->uploaded / MAX((float)s->downloaded, (float)inf->totalSize * s->progress);
    477469    }
    478470   
Note: See TracChangeset for help on using the changeset viewer.