Changeset 9066


Ignore:
Timestamp:
Sep 8, 2009, 6:25:40 AM (13 years ago)
Author:
charles
Message:

add better logging to track down tr_ioRead() error messages reported by Rabbitbunny

Location:
trunk/libtransmission
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/fdlimit.c

    r8960 r9066  
    353353    /* this doubles the OS level readahead buffer, which in practice
    354354     * turns out to be a good thing, because many (most?) clients request
    355      * chunks of blocks in order */
    356     posix_fadvise( file->fd, 0, 0, POSIX_FADV_SEQUENTIAL );
     355     * chunks of blocks in order.
     356     * It's okay for this to fail silently, so don't let it affect errno */
     357    {
     358        const int err = errno;
     359        posix_fadvise( file->fd, 0, 0, POSIX_FADV_SEQUENTIAL );
     360        errno = err;
     361    }
    357362#endif
    358363
  • trunk/libtransmission/inout.c

    r8935 r9066  
    101101
    102102    if( ( ioMode == TR_IO_READ ) && !fileExists ) /* does file exist? */
     103        err = ENOENT;
     104    else if( ( fd = tr_fdFileCheckout( tor->uniqueId, tor->downloadDir, file->name, ioMode == TR_IO_WRITE, preallocationMode, file->length ) ) < 0 ) {
    103105        err = errno;
    104     else if( ( fd = tr_fdFileCheckout ( tor->uniqueId, tor->downloadDir, file->name, ioMode == TR_IO_WRITE, preallocationMode, file->length ) ) < 0 )
     106        tr_torerr( tor, "tr_fdFileCheckout failed for \"%s\": %s", file->name, tr_strerror( err ) );
     107    }
     108    else if( tr_lseek( fd, (int64_t)fileOffset, SEEK_SET ) == -1 ) {
    105109        err = errno;
    106     else if( tr_lseek( fd, (int64_t)fileOffset, SEEK_SET ) == -1 )
     110        tr_torerr( tor, "tr_lseek failed for \"%s\": %s", file->name, tr_strerror( err ) );
     111    }
     112    else if( func( fd, buf, buflen ) != buflen ) {
    107113        err = errno;
    108     else if( func( fd, buf, buflen ) != buflen )
    109         err = errno;
     114        tr_torerr( tor, "read/write failed for \"%s\": %s", file->name, tr_strerror( err ) );
     115    }
    110116    else
    111117        err = 0;
     
    176182    {
    177183        const tr_file * file = &info->files[fileIndex];
    178         const uint64_t  bytesThisPass = MIN( buflen, file->length - fileOffset );
     184        const uint64_t bytesThisPass = MIN( buflen, file->length - fileOffset );
    179185
    180186        err = readOrWriteBytes( tor, ioMode, fileIndex, fileOffset, buf, bytesThisPass );
Note: See TracChangeset for help on using the changeset viewer.