Changeset 5189


Ignore:
Timestamp:
Mar 3, 2008, 9:51:45 PM (14 years ago)
Author:
charles
Message:

#751: add some tracer bullets to help track down this error.

File:
1 edited

Legend:

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

    r5185 r5189  
    682682{
    683683    const tr_torrent * tor = msgs->torrent;
     684    int err = 0;
    684685
    685686    if( index >= (uint32_t) tor->info.pieceCount )
    686         return FALSE;
    687     if ( (int)offset >= tr_torPieceCountBytes( tor, (int)index ) )
    688         return FALSE;
    689     if( length > MAX_REQUEST_BYTE_COUNT )
    690         return FALSE;
    691     if( tr_pieceOffset( tor, index, offset, length ) > tor->info.totalSize )
    692         return FALSE;
    693 
    694     return TRUE;
     687        err = 1;
     688    else if ( (int)offset >= tr_torPieceCountBytes( tor, (int)index ) )
     689        err = 2;
     690    else if( length > MAX_REQUEST_BYTE_COUNT )
     691        err = 3;
     692    else if( tr_pieceOffset( tor, index, offset, length ) > tor->info.totalSize )
     693        err = 4;
     694
     695    if( !err )
     696    {
     697        fprintf( stderr, "(ticket #751) err is %d\n", err );
     698        fprintf( stderr, "(ticket #751) req.index is %"PRIu32"\n", index );
     699        fprintf( stderr, "(ticket #751) req.offset is %"PRIu32"\n", offset );
     700        fprintf( stderr, "(ticket #751) req.length is %"PRIu32"\n", length );
     701        fprintf( stderr, "(ticket #751) tor->info.totalSize is %"PRIu64"\n", tor->info.totalSize );
     702        fprintf( stderr, "(ticket #751) tor->info.pieceCount is %d\n", tor->info.pieceCount );
     703        fprintf( stderr, "(ticket #751) tr_torPieceCountBytes is %d\n", tr_torPieceCountBytes( tor, (int)index ) );
     704        fprintf( stderr, "(ticket #751) tr_pieceOffset is %"PRIu64"\n", tr_pieceOffset( tor, index, offset, length ) );
     705    }
     706
     707    return !err;
    695708}
    696709
Note: See TracChangeset for help on using the changeset viewer.