mirror of
https://github.com/transmission/transmission
synced 2025-03-15 16:29:34 +00:00
(trunk libT) in tr_torrentFiles(), avoid some expensive calculations if the torrent is a seed.
This commit is contained in:
parent
a2b53f5cbd
commit
cf552651f7
1 changed files with 2 additions and 1 deletions
|
@ -1042,12 +1042,13 @@ tr_torrentFiles( const tr_torrent * tor,
|
|||
const tr_file_index_t n = tor->info.fileCount;
|
||||
tr_file_stat * files = tr_new0( tr_file_stat, n );
|
||||
tr_file_stat * walk = files;
|
||||
const tr_bool isSeed = tor->completeness == TR_SEED;
|
||||
|
||||
assert( tr_isTorrent( tor ) );
|
||||
|
||||
for( i = 0; i < n; ++i, ++walk )
|
||||
{
|
||||
const uint64_t b = fileBytesCompleted( tor, i );
|
||||
const uint64_t b = isSeed ? tor->info.files[i].length : fileBytesCompleted( tor, i );
|
||||
walk->bytesCompleted = b;
|
||||
walk->progress = tr_getRatio( b, tor->info.files[i].length );
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue