Changeset 11468


Ignore:
Timestamp:
Dec 5, 2010, 6:38:08 PM (11 years ago)
Author:
charles
Message:

(2.0x libtransmission) backport r11264 for #3453 "Torrent does not stop when set per torrent seed ratio is reached before torrent is completed"

Location:
branches/2.0x/libtransmission
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/2.0x/libtransmission/peer-mgr.c

    r10894 r11468  
    23802380**/
    23812381
     2382void
     2383tr_peerMgrClearInterest( tr_torrent * tor )
     2384{
     2385    int i;
     2386    Torrent * t;
     2387    int peerCount;
     2388
     2389    assert( tr_isTorrent( tor ) );
     2390
     2391    t = tor->torrentPeers;
     2392
     2393    torrentLock( t );
     2394
     2395    peerCount = tr_ptrArraySize( &t->peers );
     2396
     2397    for( i=0; i<peerCount; ++i )
     2398    {
     2399        const tr_peer * peer = tr_ptrArrayNth( &t->peers, i );
     2400        tr_peerMsgsSetInterested( peer->msgs, FALSE );
     2401    }
     2402
     2403    torrentUnlock( t );
     2404}
     2405
    23822406/* do we still want this piece and does the peer have it? */
    23832407static tr_bool
  • branches/2.0x/libtransmission/peer-mgr.h

    r10751 r11468  
    237237                             tr_direction       direction );
    238238
     239void tr_peerMgrClearInterest( tr_torrent * tor );
     240
    239241/* @} */
    240242
  • branches/2.0x/libtransmission/torrent.c

    r10997 r11468  
    14761476    /* if the torrent's running, stop it & set the restart-after-verify flag */
    14771477    if( tor->startAfterVerify || tor->isRunning ) {
     1478        /* don't clobber isStopping */
     1479        const tr_bool startAfter = tor->isStopping ? FALSE : TRUE;
    14781480        tr_torrentStop( tor );
    1479         tor->startAfterVerify = TRUE;
     1481        tor->startAfterVerify = startAfter;
    14801482    }
    14811483
     
    17011703tr_torrentRecheckCompleteness( tr_torrent * tor )
    17021704{
    1703     tr_bool wasRunning;
    17041705    tr_completeness completeness;
    17051706
     
    17091710
    17101711    completeness = tr_cpGetStatus( &tor->completion );
    1711     wasRunning = tor->isRunning;
    17121712
    17131713    if( completeness != tor->completeness )
    17141714    {
    17151715        const int recentChange = tor->downloadedCur != 0;
     1716        const tr_bool wasLeeching = !tr_torrentIsSeed( tor );
     1717        const tr_bool wasRunning = tor->isRunning;
    17161718
    17171719        if( recentChange )
     
    17311733                tr_announcerTorrentCompleted( tor );
    17321734                tor->doneDate = tor->anyDate = tr_time( );
     1735            }
     1736
     1737            if( wasLeeching && wasRunning )
     1738            {
     1739                /* clear interested flag on all peers */
     1740                tr_peerMgrClearInterest( tor );
     1741
     1742                /* if completeness was TR_LEECH then the seed limit check will have been skipped in bandwidthPulse */
     1743                tr_torrentCheckSeedRatio( tor );
    17331744            }
    17341745
Note: See TracChangeset for help on using the changeset viewer.