Changeset 10999


Ignore:
Timestamp:
Jul 11, 2010, 9:02:30 PM (12 years ago)
Author:
livings124
Message:

Have libtransmission keep track of idle seconds. Use this value for determining the stalled minutes in the Mac code.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/torrent.c

    r10998 r10999  
    10021002    s->startDate    = tor->startDate;
    10031003
     1004    if (s->activity == TR_STATUS_DOWNLOAD || s->activity == TR_STATUS_SEED)
     1005        s->idleSecs = difftime(tr_time(), tor->anyDate);
     1006    else
     1007        s->idleSecs = -1;
     1008
    10041009    s->corruptEver     = tor->corruptCur    + tor->corruptPrev;
    10051010    s->downloadedEver  = tor->downloadedCur + tor->downloadedPrev;
  • trunk/libtransmission/transmission.h

    r10959 r10999  
    18441844    time_t    activityDate;
    18451845   
     1846    /** Number of seconds since the last activity (or since started).
     1847        -1 if activity is not seeding or downloading. */
     1848    int    idleSecs;
     1849   
    18461850    /** A torrent is considered finished if it has met its seed ratio.
    18471851        As a result, only paused torrents can be finished. */
  • trunk/macosx/Torrent.m

    r10949 r10999  
    14801480- (NSInteger) stalledMinutes
    14811481{
    1482     const time_t start = fStat->startDate;
    1483     if (start == 0)
    1484         return -1;
    1485    
    1486     NSDate * started = [NSDate dateWithTimeIntervalSince1970: start],
    1487             * activity = [self dateActivity];
    1488    
    1489     NSDate * laterDate = activity ? [started laterDate: activity] : started;
    1490    
    1491     return ABS([laterDate timeIntervalSinceNow]) / 60;
     1482    return fStat->idleSecs / 60;
    14921483}
    14931484
Note: See TracChangeset for help on using the changeset viewer.