mirror of
https://github.com/transmission/transmission
synced 2025-03-15 16:29:34 +00:00
(trunk libT) #1869 "new status for torrents that reach seed ratio" -- possible fix for the bug reported by leena
This commit is contained in:
parent
d8f49d083c
commit
b7827565ee
4 changed files with 3 additions and 27 deletions
|
@ -1312,8 +1312,6 @@ peerCallbackFunc( void * vpeer, void * vevent, void * vt )
|
|||
if( peer && e->wasPieceData )
|
||||
peer->atom->piece_data_time = now;
|
||||
|
||||
tor->needsSeedRatioCheck = TRUE;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -3296,12 +3294,8 @@ bandwidthPulse( int foo UNUSED, short bar UNUSED, void * vmgr )
|
|||
|
||||
/* possibly stop torrents that have seeded enough */
|
||||
tor = NULL;
|
||||
while(( tor = tr_torrentNext( mgr->session, tor ))) {
|
||||
if( tor->needsSeedRatioCheck ) {
|
||||
tor->needsSeedRatioCheck = FALSE;
|
||||
tr_torrentCheckSeedRatio( tor );
|
||||
}
|
||||
}
|
||||
while(( tor = tr_torrentNext( mgr->session, tor )))
|
||||
tr_torrentCheckSeedRatio( tor );
|
||||
|
||||
/* run the completeness check for any torrents that need it */
|
||||
tor = NULL;
|
||||
|
|
|
@ -1020,22 +1020,12 @@ tr_sessionGetPortForwarding( const tr_session * session )
|
|||
****
|
||||
***/
|
||||
|
||||
static void
|
||||
updateSeedRatio( tr_session * session )
|
||||
{
|
||||
tr_torrent * tor = NULL;
|
||||
|
||||
while(( tor = tr_torrentNext( session, tor )))
|
||||
tor->needsSeedRatioCheck = TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
tr_sessionSetRatioLimited( tr_session * session, tr_bool isLimited )
|
||||
{
|
||||
assert( tr_isSession( session ) );
|
||||
|
||||
session->isRatioLimited = isLimited;
|
||||
updateSeedRatio( session );
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1044,7 +1034,6 @@ tr_sessionSetRatioLimit( tr_session * session, double desiredRatio )
|
|||
assert( tr_isSession( session ) );
|
||||
|
||||
session->desiredRatio = desiredRatio;
|
||||
updateSeedRatio( session );
|
||||
}
|
||||
|
||||
tr_bool
|
||||
|
|
|
@ -202,7 +202,6 @@ tr_torrentSetRatioMode( tr_torrent * tor, tr_ratiolimit mode )
|
|||
if( mode != tor->ratioLimitMode )
|
||||
{
|
||||
tor->ratioLimitMode = mode;
|
||||
tor->needsSeedRatioCheck = TRUE;
|
||||
|
||||
tr_torrentSetDirty( tor );
|
||||
}
|
||||
|
@ -225,8 +224,6 @@ tr_torrentSetRatioLimit( tr_torrent * tor, double desiredRatio )
|
|||
{
|
||||
tor->desiredRatio = desiredRatio;
|
||||
|
||||
tor->needsSeedRatioCheck = TRUE;
|
||||
|
||||
tr_torrentSetDirty( tor );
|
||||
}
|
||||
}
|
||||
|
@ -321,7 +318,7 @@ tr_torrentCheckSeedRatio( tr_torrent * tor )
|
|||
{
|
||||
assert( tr_isTorrent( tor ) );
|
||||
|
||||
/* if we're seeding and we've reached our seed ratio limit, stop the torrent */
|
||||
/* if we're seeding and reach our seed ratio limit, stop the torrent */
|
||||
if( tor->isRunning && tr_torrentIsSeedRatioDone( tor ) )
|
||||
{
|
||||
tr_torinf( tor, "Seed ratio reached; pausing torrent" );
|
||||
|
@ -1394,7 +1391,6 @@ checkAndStartImpl( void * vtor )
|
|||
{
|
||||
const time_t now = tr_time( );
|
||||
tor->isRunning = TRUE;
|
||||
tor->needsSeedRatioCheck = TRUE;
|
||||
tor->error = TR_STAT_OK;
|
||||
tor->errorString[0] = '\0';
|
||||
tor->completeness = tr_cpGetStatus( &tor->completion );
|
||||
|
@ -1713,7 +1709,6 @@ tr_torrentRecheckCompleteness( tr_torrent * tor )
|
|||
}
|
||||
|
||||
tor->completeness = completeness;
|
||||
tor->needsSeedRatioCheck = TRUE;
|
||||
tr_fdTorrentClose( tor->session, tor->uniqueId );
|
||||
|
||||
/* if the torrent is a seed now,
|
||||
|
@ -1896,7 +1891,6 @@ tr_torrentInitFileDLs( tr_torrent * tor,
|
|||
setFileDND( tor, files[i], doDownload );
|
||||
|
||||
tr_cpInvalidateDND( &tor->completion );
|
||||
tor->needsSeedRatioCheck = TRUE;
|
||||
|
||||
tr_torrentUnlock( tor );
|
||||
}
|
||||
|
|
|
@ -227,7 +227,6 @@ struct tr_torrent
|
|||
|
||||
tr_bool isRunning;
|
||||
tr_bool isDeleting;
|
||||
tr_bool needsSeedRatioCheck;
|
||||
tr_bool startAfterVerify;
|
||||
tr_bool isDirty;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue