1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-25 17:17:31 +00:00

fix: another piece priority fix (#2099)

move initialization to later in torrent construction so that we can correctly check whether the torrent is done or not
This commit is contained in:
Charles Kerr 2021-11-05 00:06:19 -05:00 committed by GitHub
parent 344ac056c8
commit 087a804b49
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 3 deletions

View file

@ -900,7 +900,7 @@ static uint64_t loadFromFile(tr_torrent* tor, uint64_t fieldsToLoad, bool* didRe
// Only load file priorities if we are actually downloading. // Only load file priorities if we are actually downloading.
// If we're a seed or partial seed, loading it is a waste of time. // If we're a seed or partial seed, loading it is a waste of time.
// NB: this is why loadProgress() comes before loadFilePriorities() // NB: this is why loadProgress() comes before loadFilePriorities()
if (!tr_torrentIsSeed(tor) && (fieldsToLoad & TR_FR_FILE_PRIORITIES) != 0) if ((tr_cpLeftUntilDone(&tor->completion) != 0) && (fieldsToLoad & TR_FR_FILE_PRIORITIES) != 0)
{ {
fieldsLoaded |= loadFilePriorities(&top, tor); fieldsLoaded |= loadFilePriorities(&top, tor);
} }

View file

@ -785,8 +785,6 @@ static void torrentInitFromInfo(tr_torrent* tor)
tr_cpConstruct(&tor->completion, tor); tr_cpConstruct(&tor->completion, tor);
tr_torrentInitFilePieces(tor); tr_torrentInitFilePieces(tor);
tor->completeness = tr_cpGetStatus(&tor->completion);
tr_torrentInitPiecePriorities(tor);
} }
static void tr_torrentFireMetadataCompleted(tr_torrent* tor); static void tr_torrentFireMetadataCompleted(tr_torrent* tor);
@ -909,6 +907,7 @@ static void torrentInit(tr_torrent* tor, tr_ctor const* ctor)
tr_ctorInitTorrentPriorities(ctor, tor); tr_ctorInitTorrentPriorities(ctor, tor);
tr_ctorInitTorrentWanted(ctor, tor); tr_ctorInitTorrentWanted(ctor, tor);
tr_torrentInitPiecePriorities(tor);
refreshCurrentDir(tor); refreshCurrentDir(tor);