Changeset 11264


Ignore:
Timestamp:
Sep 25, 2010, 12:34:15 AM (11 years ago)
Author:
Longinus00
Message:

(libT) #3453:Torrent does not stop when set per torrent seed ratio is reached before torrent is completed
(libT) #3578:Interested flag isn't cleared when transitioning from leeching to seeding

Location:
trunk/libtransmission
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/peer-mgr.c

    r11241 r11264  
    23852385**/
    23862386
     2387void
     2388tr_peerMgrClearInterest( tr_torrent * tor )
     2389{
     2390    int i;
     2391    Torrent * t;
     2392    int peerCount;
     2393
     2394    assert( tr_isTorrent( tor ) );
     2395
     2396    t = tor->torrentPeers;
     2397
     2398    torrentLock( t );
     2399
     2400    peerCount = tr_ptrArraySize( &t->peers );
     2401
     2402    for( i=0; i<peerCount; ++i )
     2403    {
     2404        const tr_peer * peer = tr_ptrArrayNth( &t->peers, i );
     2405        tr_peerMsgsSetInterested( peer->msgs, FALSE );
     2406    }
     2407
     2408    torrentUnlock( t );
     2409}
     2410
    23872411/* do we still want this piece and does the peer have it? */
    23882412static tr_bool
  • trunk/libtransmission/peer-mgr.h

    r10937 r11264  
    235235                              tr_direction       direction );
    236236
     237void tr_peerMgrClearInterest( tr_torrent * tor );
     238
    237239/* @} */
    238240
  • trunk/libtransmission/torrent.c

    r11243 r11264  
    16001600    /* if the torrent's running, stop it & set the restart-after-verify flag */
    16011601    if( tor->startAfterVerify || tor->isRunning ) {
     1602        /* don't clobber isStopping */
     1603        const tr_bool startAfter = tor->isStopping ? FALSE : TRUE;
    16021604        tr_torrentStop( tor );
    1603         tor->startAfterVerify = TRUE;
     1605        tor->startAfterVerify = startAfter;
    16041606    }
    16051607
     
    18481850tr_torrentRecheckCompleteness( tr_torrent * tor )
    18491851{
    1850     tr_bool wasRunning;
    18511852    tr_completeness completeness;
    18521853
     
    18561857
    18571858    completeness = tr_cpGetStatus( &tor->completion );
    1858     wasRunning = tor->isRunning;
    18591859
    18601860    if( completeness != tor->completeness )
    18611861    {
    18621862        const int recentChange = tor->downloadedCur != 0;
     1863        const tr_bool wasLeeching = !tr_torrentIsSeed( tor );
     1864        const tr_bool wasRunning = tor->isRunning;
    18631865
    18641866        if( recentChange )
     
    18781880                tr_announcerTorrentCompleted( tor );
    18791881                tor->doneDate = tor->anyDate = tr_time( );
     1882            }
     1883
     1884            if( wasLeeching && wasRunning )
     1885            {
     1886                /* clear interested flag on all peers */
     1887                tr_peerMgrClearInterest( tor );
     1888
     1889                /* if completeness was TR_LEECH then the seed limit check will have been skipped in bandwidthPulse */
     1890                tr_torrentCheckSeedLimit( tor );
    18801891            }
    18811892
Note: See TracChangeset for help on using the changeset viewer.