mirror of
https://github.com/transmission/transmission
synced 2025-03-20 02:35:43 +00:00
(trunk libT) #3631 "crash in tr_ioFindFileLocation" -- more tracer messages for the testers @ https://forum.transmissionbt.com/viewtopic.php?p=49625#p49625
This commit is contained in:
parent
74cff042ea
commit
b51b6b14ae
1 changed files with 14 additions and 11 deletions
|
@ -188,23 +188,26 @@ tr_ioFindFileLocation( const tr_torrent * tor,
|
|||
const tr_file * file;
|
||||
|
||||
assert( tr_isTorrent( tor ) );
|
||||
|
||||
if( offset >= tor->info.totalSize )
|
||||
{
|
||||
tr_file_index_t i;
|
||||
fprintf( stderr, "looking for torrent offset is %"PRIu64"\n", offset );
|
||||
fprintf( stderr, "total torrent size %"PRIu64"\n", tor->info.totalSize );
|
||||
fprintf( stderr, "pieceIndex %d\n", (int)pieceIndex );
|
||||
fprintf( stderr, "pieceOffset %d\n", (int)pieceOffset );
|
||||
fprintf( stderr, "piece size is %d\n", (int)tor->info.pieceSize );
|
||||
fprintf( stderr, "last piece size is %d\n", (int)tor->lastPieceSize );
|
||||
fprintf( stderr, "%u files\n", (unsigned int)tor->info.fileCount );
|
||||
for( i=0; i<tor->info.fileCount; ++i ) fprintf( stderr, "file #%u offset %"PRIu64" length %"PRIu64"\n", i, tor->info.files[i].offset, tor->info.files[i].length );
|
||||
}
|
||||
|
||||
assert( offset < tor->info.totalSize );
|
||||
|
||||
file = bsearch( &offset,
|
||||
tor->info.files, tor->info.fileCount, sizeof( tr_file ),
|
||||
compareOffsetToFile );
|
||||
|
||||
if( file == NULL ) {
|
||||
unsigned int i;
|
||||
fprintf( stderr, "%s", "transmission error\n" );
|
||||
fprintf( stderr, "pieceIndex %d\n", (int)pieceIndex );
|
||||
fprintf( stderr, "pieceOffset %d\n", (int)pieceOffset );
|
||||
fprintf( stderr, "couldn't find file matching offset %"PRIu64"\n", offset );
|
||||
fprintf( stderr, "total torrent size %"PRIu64"\n", tor->info.totalSize );
|
||||
fprintf( stderr, "%u files\n", (unsigned int)tor->info.fileCount );
|
||||
for( i=0; i<tor->info.fileCount; ++i ) fprintf( stderr, "file #%u offset %"PRIu64" length %"PRIu64"\n", i, tor->info.files[i].offset, tor->info.files[i].length );
|
||||
}
|
||||
|
||||
assert( file != NULL );
|
||||
|
||||
*fileIndex = file - tor->info.files;
|
||||
|
|
Loading…
Add table
Reference in a new issue