Changeset 10848


Ignore:
Timestamp:
Jun 25, 2010, 6:57:34 AM (12 years ago)
Author:
charles
Message:

(trunk) #3320: "If the seed ratio is already met when download completes, the Mac callback options do not occur" -- possible fix. needs confirmation from OP or BMW

Location:
trunk/libtransmission
Files:
5 edited

Legend:

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

    r10824 r10848  
    31673167    }
    31683168
    3169     /* possibly stop torrents that have an error */
     3169    /* stop torrents that are ready to stop, but couldn't be stopped earlier
     3170     * during the peer-io callback call chain */
    31703171    tor = NULL;
    31713172    while(( tor = tr_torrentNext( mgr->session, tor )))
    3172         if( tor->isRunning && ( tor->error == TR_STAT_LOCAL_ERROR ))
     3173        if( tor->isStopping )
    31733174            tr_torrentStop( tor );
    31743175
  • trunk/libtransmission/rpcimpl.c

    r10814 r10848  
    222222    {
    223223        tr_torrent * tor = torrents[i];
     224
    224225        if( tor->isRunning )
    225226        {
    226             tr_torrentStop( tor );
     227            tor->isStopping = TRUE;
    227228            notify( session, TR_RPC_TORRENT_STOPPED, tor );
    228229        }
  • trunk/libtransmission/torrent.c

    r10842 r10848  
    323323        tr_torinf( tor, "Seed ratio reached; pausing torrent" );
    324324
    325         tr_torrentStop( tor );
     325        tor->isStopping = TRUE;
    326326
    327327        /* maybe notify the client */
     
    348348    evutil_vsnprintf( tor->errorString, sizeof( tor->errorString ), fmt, ap );
    349349    va_end( ap );
     350
     351    if( tor->isRunning )
     352        tor->isStopping = TRUE;
    350353}
    351354
     
    13551358    {
    13561359        tr_torrentSetLocalError( tor, _( "No data found!  Reconnect any disconnected drives, use \"Set Location\", or restart the torrent to re-download." ) );
    1357         tr_torrentStop( tor );
    13581360    }
    13591361    else
     
    14381440    {
    14391441        tr_torrentSetLocalError( tor, _( "Can't find local data.  Try \"Set Location\" to find it, or restart the torrent to re-download." ) );
    1440         tr_torrentStop( tor );
    14411442    }
    14421443    else if( tor->startAfterVerify )
     
    15291530
    15301531        tor->isRunning = 0;
     1532        tor->isStopping = 0;
    15311533        tr_torrentSetDirty( tor );
    15321534        tr_runInEventThread( tor->session, stopTorrent, tor );
     
    16141616static void
    16151617fireCompletenessChange( tr_torrent       * tor,
    1616                         tr_completeness    status )
     1618                        tr_completeness    status,
     1619                        tr_bool            wasPaused )
    16171620{
    16181621    assert( tr_isTorrent( tor ) );
     
    16221625
    16231626    if( tor->completeness_func )
    1624         tor->completeness_func( tor, status, tor->completeness_func_user_data );
     1627        tor->completeness_func( tor, status, wasPaused,
     1628                                tor->completeness_func_user_data );
    16251629}
    16261630
     
    17011705tr_torrentRecheckCompleteness( tr_torrent * tor )
    17021706{
     1707    tr_bool wasPaused;
    17031708    tr_completeness completeness;
    17041709
     
    17081713
    17091714    completeness = tr_cpGetStatus( &tor->completion );
     1715    wasPaused = tor->isRunning;
    17101716
    17111717    if( completeness != tor->completeness )
     
    17401746        }
    17411747
    1742         fireCompletenessChange( tor, completeness );
     1748        fireCompletenessChange( tor, wasPaused, completeness );
    17431749
    17441750        tr_torrentSetDirty( tor );
  • trunk/libtransmission/torrent.h

    r10842 r10848  
    231231
    232232    tr_bool                    isRunning;
     233    tr_bool                    isStopping;
    233234    tr_bool                    isDeleting;
    234235    tr_bool                    startAfterVerify;
  • trunk/libtransmission/transmission.h

    r10798 r10848  
    12751275tr_completeness;
    12761276
     1277/**
     1278 * @param wasPaused whether or not the torrent was in a paused state when
     1279 *                  it changed its completeness state
     1280 */
    12771281typedef void ( tr_torrent_completeness_func )( tr_torrent       * torrent,
    12781282                                               tr_completeness    completeness,
     1283                                               tr_bool            wasPaused,
    12791284                                               void             * user_data );
    12801285
Note: See TracChangeset for help on using the changeset viewer.