Changeset 8915


Ignore:
Timestamp:
Aug 13, 2009, 5:50:41 PM (13 years ago)
Author:
charles
Message:

(trunk libT) fix #1765: "if a downloaded file disappears, stop the torrent instead of redownloading it"

Location:
trunk/libtransmission
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/torrent.c

    r8912 r8915  
    12601260checkAndStartImpl( void * vtor )
    12611261{
    1262     time_t now;
    12631262    tr_torrent * tor = vtor;
    12641263
     
    12671266    tr_globalLock( tor->session );
    12681267
    1269     now = time( NULL );
    1270     tor->isRunning = TRUE;
    1271     tor->needsSeedRatioCheck = TRUE;
    1272     tor->error = TR_STAT_OK;
    1273     tor->errorString[0] = '\0';
    1274     tor->completeness = tr_cpGetStatus( &tor->completion );
    1275     tor->startDate = tor->anyDate = now;
    1276     tr_torrentResetTransferStats( tor );
    1277     tr_trackerStart( tor->tracker );
    1278     tor->dhtAnnounceAt = now + tr_cryptoWeakRandInt( 20 );
    1279     tr_peerMgrStartTorrent( tor );
     1268    /** If we had local data before, but it's disappeared,
     1269        stop the torrent and log an error. */
     1270    if( tor->preVerifyTotal && !tr_cpHaveTotal( &tor->completion ) )
     1271    {
     1272        tr_torrentSetLocalError( tor, "Can't find local data.  Try \"Set Location\" to find it, or restart the torrent to re-download." );
     1273        tr_torrentStop( tor );
     1274    }
     1275    else
     1276    {
     1277        const time_t now = time( NULL );
     1278        tor->isRunning = TRUE;
     1279        tor->needsSeedRatioCheck = TRUE;
     1280        tor->error = TR_STAT_OK;
     1281        tor->errorString[0] = '\0';
     1282        tor->completeness = tr_cpGetStatus( &tor->completion );
     1283        tor->startDate = tor->anyDate = now;
     1284        tr_torrentResetTransferStats( tor );
     1285        tr_trackerStart( tor->tracker );
     1286        tor->dhtAnnounceAt = now + tr_cryptoWeakRandInt( 20 );
     1287        tr_peerMgrStartTorrent( tor );
     1288    }
    12801289
    12811290    tr_globalUnlock( tor->session );
     
    13021311        tr_verifyRemove( tor );
    13031312        tor->isRunning = 1;
     1313        tor->preVerifyTotal = tr_cpHaveTotal( &tor->completion );
    13041314        tr_verifyAdd( tor, checkAndStartCB );
    13051315    }
  • trunk/libtransmission/torrent.h

    r8912 r8915  
    229229    double                     desiredRatio;
    230230    tr_ratiolimit              ratioLimitMode;
     231
     232    uint64_t                   preVerifyTotal;
    231233};
    232234
Note: See TracChangeset for help on using the changeset viewer.