Changeset 7199


Ignore:
Timestamp:
Nov 30, 2008, 1:52:45 AM (12 years ago)
Author:
charles
Message:

#1379 lay some very early groundwork for "partial seeds" -- change tr_completion's enum to use the partial seed terminology

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/tr-torrent.c

    r6978 r7199  
    167167                             void *             user_data )
    168168{
    169     if( completeness == TR_CP_COMPLETE )
     169    if( completeness != TR_LEECH )
    170170        g_idle_add( notifyInMainThread, user_data );
    171171}
  • trunk/libtransmission/completion.c

    r7173 r7199  
    303303tr_cpGetStatus( const tr_completion * cp )
    304304{
    305     if( cp->sizeNow == cp->tor->info.totalSize ) return TR_CP_COMPLETE;
    306     if( cp->sizeNow == tr_cpSizeWhenDone( cp ) ) return TR_CP_DONE;
    307     return TR_CP_INCOMPLETE;
     305    if( cp->sizeNow == cp->tor->info.totalSize ) return TR_SEED;
     306    if( cp->sizeNow == tr_cpSizeWhenDone( cp ) ) return TR_PARTIAL_SEED;
     307    return TR_LEECH;
    308308}
    309309
     
    355355    const tr_torrent * tor = cp->tor;
    356356    const float        interval = tor->info.pieceCount / (float)tabCount;
    357     const int          isComplete = tr_cpGetStatus ( tor->completion ) ==
    358                                     TR_CP_COMPLETE;
     357    const int          isSeed = tr_cpGetStatus ( tor->completion ) == TR_SEED;
    359358
    360359    for( i = 0; i < tabCount; ++i )
     
    364363        if( tor == NULL )
    365364            tab[i] = 0.0f;
    366         else if( isComplete || tr_cpPieceIsComplete( cp, piece ) )
     365        else if( isSeed || tr_cpPieceIsComplete( cp, piece ) )
    367366            tab[i] = 1.0f;
    368367        else
  • trunk/libtransmission/peer-mgr.c

    r7195 r7199  
    15411541    const tr_torrent * tor;
    15421542    float              interval;
    1543     int                isComplete;
     1543    int                isSeed;
    15441544    int                peerCount;
    15451545    const tr_peer **   peers;
     
    15501550    tor = t->tor;
    15511551    interval = tor->info.pieceCount / (float)tabCount;
    1552     isComplete = tor
    1553                  && ( tr_cpGetStatus ( tor->completion ) == TR_CP_COMPLETE );
     1552    isSeed = tor && ( tr_cpGetStatus ( tor->completion ) == TR_SEED );
    15541553    peers = (const tr_peer **) tr_ptrArrayPeek( t->peers, &peerCount );
    15551554
     
    15601559        const int piece = i * interval;
    15611560
    1562         if( isComplete || tr_cpPieceIsComplete( tor->completion, piece ) )
     1561        if( isSeed || tr_cpPieceIsComplete( tor->completion, piece ) )
    15631562            tab[i] = -1;
    15641563        else if( peerCount )
  • trunk/libtransmission/torrent.c

    r7158 r7199  
    751751    if( !tor->isRunning )
    752752        return TR_STATUS_STOPPED;
    753     if( tor->completeness == TR_CP_INCOMPLETE )
     753    if( tor->completeness == TR_LEECH )
    754754        return TR_STATUS_DOWNLOAD;
    755755
     
    12621262           "Done" means we're done downloading the files we wanted, but NOT all
    12631263           that exist */
    1264         case TR_CP_DONE:
     1264        case TR_PARTIAL_SEED:
    12651265            return _( "Done" );
    12661266
    1267         case TR_CP_COMPLETE:
     1267        case TR_SEED:
    12681268            return _( "Complete" );
    12691269
     
    12781278{
    12791279    assert( tor );
    1280     assert( ( status == TR_CP_INCOMPLETE )
    1281          || ( status == TR_CP_DONE )
    1282          || ( status == TR_CP_COMPLETE ) );
     1280    assert( ( status == TR_LEECH )
     1281         || ( status == TR_SEED )
     1282         || ( status == TR_PARTIAL_SEED ) );
    12831283
    12841284    if( tor->completeness_func )
     
    13251325        fireCompletenessChange( tor, completeness );
    13261326
    1327         if( recentChange && ( completeness == TR_CP_COMPLETE ) )
     1327        if( recentChange && ( completeness == TR_SEED ) )
    13281328        {
    13291329            tr_trackerCompleted( tor->tracker );
     
    13411341tr_torrentIsSeed( const tr_torrent * tor )
    13421342{
    1343     return tor->completeness == TR_CP_COMPLETE || tor->completeness == TR_CP_DONE;
     1343    return tor->completeness == TR_SEED || tor->completeness == TR_PARTIAL_SEED;
    13441344}
    13451345
  • trunk/libtransmission/transmission.h

    r7195 r7199  
    996996typedef enum
    997997{
    998     TR_CP_INCOMPLETE,   /* doesn't have all the desired pieces */
    999     TR_CP_DONE,         /* has all the desired pieces, but not all pieces */
    1000     TR_CP_COMPLETE      /* has every piece */
     998    TR_LEECH,           /* doesn't have all the desired pieces */
     999    TR_SEED,            /* has the entire torrent */
     1000    TR_PARTIAL_SEED     /* has the desired pieces, but not the entire torrent */
    10011001}
    10021002tr_completeness;
     
    10091009 * Register to be notified whenever a torrent's "completeness"
    10101010 * changes.  This will be called, for example, when a torrent
    1011  * finishes downloading and changes from TR_CP_INCOMPLETE to
    1012  * either TR_CP_COMPLETE or TR_CP_DONE.
     1011 * finishes downloading and changes from TR_LEECH to
     1012 * either TR_SEED or TR_PARTIAL_SEED.
    10131013 *
    10141014 * func is invoked FROM LIBTRANSMISSION'S THREAD!
     
    13271327
    13281328    /** Byte count of all the piece data we'll have downloaded when we're done,
    1329         whether or not we have it yet. [0...tr_info.totalSize] */
     1329        whether or not we have it yet.  This may be less than tr_info.totalSize
     1330        if only some of the torrent's files are wanted.
     1331        [0...tr_info.totalSize] */
    13301332    uint64_t    sizeWhenDone;
    13311333
    1332     /** Byte count of how much data is left to be downloaded until
    1333         we're done -- that is, until we've got all the pieces we wanted.
    1334         [0...tr_info.sizeWhenDone] */
     1334    /** Byte count of how much data is left to be downloaded until we've got
     1335        all the pieces that we want.  [0...tr_info.sizeWhenDone] */
    13351336    uint64_t    leftUntilDone;
    13361337
  • trunk/macosx/Torrent.m

    r7185 r7199  
    18861886    switch ([status intValue])
    18871887    {
    1888         case TR_CP_DONE:
    1889         case TR_CP_COMPLETE:
     1888        case TR_SEED:
     1889        case TR_PARTIAL_SEED:
    18901890            canMove = YES;
    18911891           
     
    19201920            break;
    19211921       
    1922         case TR_CP_INCOMPLETE:
     1922        case TR_LEECH:
    19231923            //do not allow to be backed up by Time Machine
    19241924            [self setTimeMachineExclude: YES forPath: [[self downloadFolder] stringByAppendingPathComponent: [self name]]];
Note: See TracChangeset for help on using the changeset viewer.