diff --git a/gtk/tr-torrent.c b/gtk/tr-torrent.c index e243e97fd..ac4311712 100644 --- a/gtk/tr-torrent.c +++ b/gtk/tr-torrent.c @@ -166,7 +166,7 @@ completenessChangedCallback( tr_torrent * tor UNUSED, tr_completeness completeness, void * user_data ) { - if( completeness == TR_CP_COMPLETE ) + if( completeness != TR_LEECH ) g_idle_add( notifyInMainThread, user_data ); } diff --git a/libtransmission/completion.c b/libtransmission/completion.c index 9ff8ec336..eafaef80e 100644 --- a/libtransmission/completion.c +++ b/libtransmission/completion.c @@ -302,9 +302,9 @@ tr_cpLeftUntilComplete( const tr_completion * cp ) tr_completeness tr_cpGetStatus( const tr_completion * cp ) { - if( cp->sizeNow == cp->tor->info.totalSize ) return TR_CP_COMPLETE; - if( cp->sizeNow == tr_cpSizeWhenDone( cp ) ) return TR_CP_DONE; - return TR_CP_INCOMPLETE; + if( cp->sizeNow == cp->tor->info.totalSize ) return TR_SEED; + if( cp->sizeNow == tr_cpSizeWhenDone( cp ) ) return TR_PARTIAL_SEED; + return TR_LEECH; } static uint64_t @@ -354,8 +354,7 @@ tr_cpGetAmountDone( const tr_completion * cp, int i; const tr_torrent * tor = cp->tor; const float interval = tor->info.pieceCount / (float)tabCount; - const int isComplete = tr_cpGetStatus ( tor->completion ) == - TR_CP_COMPLETE; + const int isSeed = tr_cpGetStatus ( tor->completion ) == TR_SEED; for( i = 0; i < tabCount; ++i ) { @@ -363,7 +362,7 @@ tr_cpGetAmountDone( const tr_completion * cp, if( tor == NULL ) tab[i] = 0.0f; - else if( isComplete || tr_cpPieceIsComplete( cp, piece ) ) + else if( isSeed || tr_cpPieceIsComplete( cp, piece ) ) tab[i] = 1.0f; else tab[i] = (float)cp->completeBlocks[piece] / diff --git a/libtransmission/peer-mgr.c b/libtransmission/peer-mgr.c index 385f68849..4d2486b36 100644 --- a/libtransmission/peer-mgr.c +++ b/libtransmission/peer-mgr.c @@ -1540,7 +1540,7 @@ tr_peerMgrTorrentAvailability( const tr_peerMgr * manager, const Torrent * t; const tr_torrent * tor; float interval; - int isComplete; + int isSeed; int peerCount; const tr_peer ** peers; @@ -1549,8 +1549,7 @@ tr_peerMgrTorrentAvailability( const tr_peerMgr * manager, t = getExistingTorrent( (tr_peerMgr*)manager, torrentHash ); tor = t->tor; interval = tor->info.pieceCount / (float)tabCount; - isComplete = tor - && ( tr_cpGetStatus ( tor->completion ) == TR_CP_COMPLETE ); + isSeed = tor && ( tr_cpGetStatus ( tor->completion ) == TR_SEED ); peers = (const tr_peer **) tr_ptrArrayPeek( t->peers, &peerCount ); memset( tab, 0, tabCount ); @@ -1559,7 +1558,7 @@ tr_peerMgrTorrentAvailability( const tr_peerMgr * manager, { const int piece = i * interval; - if( isComplete || tr_cpPieceIsComplete( tor->completion, piece ) ) + if( isSeed || tr_cpPieceIsComplete( tor->completion, piece ) ) tab[i] = -1; else if( peerCount ) { diff --git a/libtransmission/torrent.c b/libtransmission/torrent.c index f52e89314..08a5b2c2e 100644 --- a/libtransmission/torrent.c +++ b/libtransmission/torrent.c @@ -750,7 +750,7 @@ tr_torrentGetActivity( tr_torrent * tor ) return TR_STATUS_CHECK_WAIT; if( !tor->isRunning ) return TR_STATUS_STOPPED; - if( tor->completeness == TR_CP_INCOMPLETE ) + if( tor->completeness == TR_LEECH ) return TR_STATUS_DOWNLOAD; return TR_STATUS_SEED; @@ -1261,10 +1261,10 @@ getCompletionString( int type ) "Complete" means we've downloaded every file in the torrent. "Done" means we're done downloading the files we wanted, but NOT all that exist */ - case TR_CP_DONE: + case TR_PARTIAL_SEED: return _( "Done" ); - case TR_CP_COMPLETE: + case TR_SEED: return _( "Complete" ); default: @@ -1277,9 +1277,9 @@ fireCompletenessChange( tr_torrent * tor, tr_completeness status ) { assert( tor ); - assert( ( status == TR_CP_INCOMPLETE ) - || ( status == TR_CP_DONE ) - || ( status == TR_CP_COMPLETE ) ); + assert( ( status == TR_LEECH ) + || ( status == TR_SEED ) + || ( status == TR_PARTIAL_SEED ) ); if( tor->completeness_func ) tor->completeness_func( tor, status, tor->completeness_func_user_data ); @@ -1324,7 +1324,7 @@ tr_torrentRecheckCompleteness( tr_torrent * tor ) tor->completeness = completeness; fireCompletenessChange( tor, completeness ); - if( recentChange && ( completeness == TR_CP_COMPLETE ) ) + if( recentChange && ( completeness == TR_SEED ) ) { tr_trackerCompleted( tor->tracker ); @@ -1340,7 +1340,7 @@ tr_torrentRecheckCompleteness( tr_torrent * tor ) int tr_torrentIsSeed( const tr_torrent * tor ) { - return tor->completeness == TR_CP_COMPLETE || tor->completeness == TR_CP_DONE; + return tor->completeness == TR_SEED || tor->completeness == TR_PARTIAL_SEED; } /** diff --git a/libtransmission/transmission.h b/libtransmission/transmission.h index ad97d8826..ecb91a74f 100644 --- a/libtransmission/transmission.h +++ b/libtransmission/transmission.h @@ -995,9 +995,9 @@ void tr_torrentSetAnnounceList( tr_torrent * torrent, typedef enum { - TR_CP_INCOMPLETE, /* doesn't have all the desired pieces */ - TR_CP_DONE, /* has all the desired pieces, but not all pieces */ - TR_CP_COMPLETE /* has every piece */ + TR_LEECH, /* doesn't have all the desired pieces */ + TR_SEED, /* has the entire torrent */ + TR_PARTIAL_SEED /* has the desired pieces, but not the entire torrent */ } tr_completeness; @@ -1008,8 +1008,8 @@ typedef void ( tr_torrent_completeness_func )( tr_torrent * torrent, /** * Register to be notified whenever a torrent's "completeness" * changes. This will be called, for example, when a torrent - * finishes downloading and changes from TR_CP_INCOMPLETE to - * either TR_CP_COMPLETE or TR_CP_DONE. + * finishes downloading and changes from TR_LEECH to + * either TR_SEED or TR_PARTIAL_SEED. * * func is invoked FROM LIBTRANSMISSION'S THREAD! * This means func must be fast (to avoid blocking peers), @@ -1326,12 +1326,13 @@ typedef struct tr_stat int timesCompleted; /** Byte count of all the piece data we'll have downloaded when we're done, - whether or not we have it yet. [0...tr_info.totalSize] */ + whether or not we have it yet. This may be less than tr_info.totalSize + if only some of the torrent's files are wanted. + [0...tr_info.totalSize] */ uint64_t sizeWhenDone; - /** Byte count of how much data is left to be downloaded until - we're done -- that is, until we've got all the pieces we wanted. - [0...tr_info.sizeWhenDone] */ + /** Byte count of how much data is left to be downloaded until we've got + all the pieces that we want. [0...tr_info.sizeWhenDone] */ uint64_t leftUntilDone; /** Byte count of all the piece data we want and don't have yet, diff --git a/macosx/Torrent.m b/macosx/Torrent.m index 4b9a37e79..200c68131 100644 --- a/macosx/Torrent.m +++ b/macosx/Torrent.m @@ -1885,8 +1885,8 @@ void completenessChangeCallback(tr_torrent * torrent, tr_completeness status, vo BOOL canMove; switch ([status intValue]) { - case TR_CP_DONE: - case TR_CP_COMPLETE: + case TR_SEED: + case TR_PARTIAL_SEED: canMove = YES; //move file from incomplete folder to download folder @@ -1919,7 +1919,7 @@ void completenessChangeCallback(tr_torrent * torrent, tr_completeness status, vo [[NSNotificationCenter defaultCenter] postNotificationName: @"TorrentFinishedDownloading" object: self]; break; - case TR_CP_INCOMPLETE: + case TR_LEECH: //do not allow to be backed up by Time Machine [self setTimeMachineExclude: YES forPath: [[self downloadFolder] stringByAppendingPathComponent: [self name]]];