Ignore:
Timestamp:
Dec 23, 2010, 7:32:59 PM (11 years ago)
Author:
charles
Message:

(trunk) #1408 "total downloading and seeding time per torrent" -- add patch to track how long a torrent has been seeding or downloading

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/resume.c

    r11506 r11583  
    5252#define KEY_USE_GLOBAL_SPEED_LIMIT "use-global-speed-limit"
    5353#define KEY_USE_SPEED_LIMIT        "use-speed-limit"
     54#define KEY_TIME_SEEDING           "seeding-time-seconds"
     55#define KEY_TIME_DOWNLOADING       "downloading-time-seconds"
    5456#define KEY_SPEEDLIMIT_DOWN_SPEED  "down-speed"
    5557#define KEY_SPEEDLIMIT_DOWN_MODE   "down-mode"
     
    506508
    507509    tr_bencInitDict( &top, 50 ); /* arbitrary "big enough" number */
     510    tr_bencDictAddInt( &top, KEY_TIME_SEEDING, tor->secondsSeeding );
     511    tr_bencDictAddInt( &top, KEY_TIME_DOWNLOADING, tor->secondsDownloading );
    508512    tr_bencDictAddInt( &top, KEY_ACTIVITY_DATE, tor->activityDate );
    509513    tr_bencDictAddInt( &top, KEY_ADDED_DATE, tor->addedDate );
     
    637641    }
    638642
     643    if( ( fieldsToLoad & TR_FR_TIME_SEEDING )
     644      && tr_bencDictFindInt( &top, KEY_TIME_SEEDING, &i ) )
     645    {
     646        tor->secondsSeeding = i;
     647        fieldsLoaded |= TR_FR_TIME_SEEDING;
     648    }
     649
     650    if( ( fieldsToLoad & TR_FR_TIME_DOWNLOADING )
     651      && tr_bencDictFindInt( &top, KEY_TIME_DOWNLOADING, &i ) )
     652    {
     653        tor->secondsDownloading = i;
     654        fieldsLoaded |= TR_FR_TIME_DOWNLOADING;
     655    }
     656
    639657    if( ( fieldsToLoad & TR_FR_BANDWIDTH_PRIORITY )
    640658      && tr_bencDictFindInt( &top, KEY_BANDWIDTH_PRIORITY, &i )
Note: See TracChangeset for help on using the changeset viewer.