From b3c8ca4604132705a10868d115a7ae8e8114b9d2 Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Sun, 12 Sep 2010 18:58:49 +0000 Subject: [PATCH] #3513 inactive limit should set torrent state as finished, not stopped --- libtransmission/torrent.c | 7 +++++-- libtransmission/torrent.h | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/libtransmission/torrent.c b/libtransmission/torrent.c index 7a09353cb..1de8ebe45 100644 --- a/libtransmission/torrent.c +++ b/libtransmission/torrent.c @@ -435,6 +435,7 @@ tr_torrentCheckSeedLimit( tr_torrent * tor ) tr_torinf( tor, "Seeding idle limit reached; pausing torrent" ); tor->isStopping = TRUE; + tor->finishedSeedingByIdle = TRUE; /* maybe notify the client */ if( tor->idle_limit_hit_func != NULL ) @@ -770,6 +771,8 @@ torrentInit( tr_torrent * tor, const tr_ctor * ctor ) tor->bandwidth->priority = tr_ctorGetBandwidthPriority( ctor ); tor->error = TR_STAT_OK; + + tor->finishedSeedingByIdle = FALSE; tr_peerMgrAddTorrent( session->peerMgr, tor ); @@ -1199,10 +1202,9 @@ tr_torrentStat( tr_torrent * tor ) break; } - #warning (maybe) do something for idle? /* s->haveValid is here to make sure a torrent isn't marked 'finished' * when the user hits "uncheck all" prior to starting the torrent... */ - s->finished = seedRatioApplies && !seedRatioBytesLeft && s->haveValid; + s->finished = tor->finishedSeedingByIdle || (seedRatioApplies && !seedRatioBytesLeft && s->haveValid); if( !seedRatioApplies || s->finished ) s->seedRatioPercentDone = 1; @@ -1492,6 +1494,7 @@ checkAndStartImpl( void * vtor ) tor->completeness = tr_cpGetStatus( &tor->completion ); tor->startDate = tor->anyDate = now; tr_torrentClearError( tor ); + tor->finishedSeedingByIdle = FALSE; tr_torrentResetTransferStats( tor ); tr_announcerTorrentStarted( tor ); diff --git a/libtransmission/torrent.h b/libtransmission/torrent.h index 00b4feaaa..dbb8a89ff 100644 --- a/libtransmission/torrent.h +++ b/libtransmission/torrent.h @@ -260,6 +260,7 @@ struct tr_torrent uint16_t idleLimitMinutes; tr_idlelimit idleLimitMode; + tr_bool finishedSeedingByIdle; uint64_t preVerifyTotal; };