Changeset 11600


Ignore:
Timestamp:
Dec 27, 2010, 9:34:12 PM (11 years ago)
Author:
charles
Message:

(trunk libT) #3852 "Removing data from an active torrent doesn't stop activity" -- possible fix.

Location:
trunk/libtransmission
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/inout.c

    r11599 r11600  
    6161static int
    6262readOrWriteBytes( tr_session       * session,
    63                   const tr_torrent * tor,
     63                  tr_torrent      * tor,
    6464                  int                ioMode,
    6565                  tr_file_index_t    fileIndex,
    6666                  uint64_t           fileOffset,
    67                   void *            buf,
     67                  void             * buf,
    6868                  size_t             buflen )
    6969{
     
    139139    if( !err )
    140140    {
     141        /* check & see if someone deleted the file while it was in our cache */
     142        struct stat sb;
     143        const tr_bool file_disappeared = fstat( fd, &sb ) || sb.st_nlink < 1;
     144        if( file_disappeared ) {
     145            tr_torrentSetLocalError( tor, "Please Verify Local Data! A file disappeared: \"%s\"", tor->info.files[fileIndex].name );
     146            err = ENOENT;
     147        }
     148
    141149        if( ioMode == TR_IO_READ ) {
    142150            const int rc = tr_pread( fd, buf, buflen, fileOffset );
     
    239247        fileOffset = 0;
    240248
    241         if( ( err != 0 ) && (ioMode == TR_IO_WRITE ) )
     249        if( ( err != 0 ) && (ioMode == TR_IO_WRITE ) && ( tor->error != TR_STAT_LOCAL_ERROR ) )
    242250        {
    243251            char * path = tr_buildPath( tor->downloadDir, file->name, NULL );
  • trunk/libtransmission/peer-msgs.c

    r11599 r11600  
    19081908            evbuffer_commit_space( out, iovec, 1 );
    19091909
    1910             /* if we couldn't load a piece we thought we could load... */
    1911             if( err )
    1912                 tr_torrentSetLocalError( msgs->torrent, _( "Couldn't read piece #%zu from disk! Please Verify Local Data." ), (size_t)req.index );
    1913 
    19141910            /* check the piece if it needs checking... */
    19151911            if( !err && tr_torrentPieceNeedsCheck( msgs->torrent, req.index ) )
    19161912                if(( err = !tr_torrentCheckPiece( msgs->torrent, req.index )))
    1917                     tr_torrentSetLocalError( msgs->torrent, _( "Piece #%zu is corrupt! Please Verify Local Data." ), (size_t)req.index );
     1913                    tr_torrentSetLocalError( msgs->torrent, _( "Please Verify Local Data! Piece #%zu is corrupt." ), (size_t)req.index );
    19181914
    19191915            if( err )
Note: See TracChangeset for help on using the changeset viewer.