#5146 'seeding complete callback called twice': revert r13627 due to issues described in https://trac.transmissionbt.com/ticket/5146#comment:15

This commit is contained in:
Jordan Lee 2013-01-27 06:02:52 +00:00
parent 388da24dd0
commit 5f9e7f773b
1 changed files with 6 additions and 5 deletions

View File

@ -2028,20 +2028,18 @@ tr_torrentRecheckCompleteness (tr_torrent * tor)
completeness = tr_cpGetStatus (&tor->completion); completeness = tr_cpGetStatus (&tor->completion);
if (completeness != tor->completeness) if (completeness != tor->completeness)
{ {
const int recentChange = tor->downloadedCur != 0; const bool recentChange = tor->downloadedCur != 0;
const bool wasLeeching = !tr_torrentIsSeed (tor); const bool wasLeeching = !tr_torrentIsSeed (tor);
const bool wasRunning = tor->isRunning; const bool wasRunning = tor->isRunning;
if (recentChange) if (recentChange)
tr_logAddTorInfo (tor, _("State changed from \"%1$s\" to \"%2$s\""), tr_logAddTorInfo (tor, _("State changed from \"%1$s\" to \"%2$s\""),
getCompletionString (tor->completeness), getCompletionString (tor->completeness),
getCompletionString (completeness)); getCompletionString (completeness));
tor->completeness = completeness; tor->completeness = completeness;
tr_fdTorrentClose (tor->session, tor->uniqueId); tr_fdTorrentClose (tor->session, tor->uniqueId);
fireCompletenessChange (tor, completeness, wasRunning);
if (tr_torrentIsSeed (tor)) if (tr_torrentIsSeed (tor))
{ {
if (recentChange) if (recentChange)
@ -2066,6 +2064,9 @@ tr_torrentRecheckCompleteness (tr_torrent * tor)
torrentCallScript (tor, tr_sessionGetTorrentDoneScript (tor->session)); torrentCallScript (tor, tr_sessionGetTorrentDoneScript (tor->session));
} }
fireCompletenessChange (tor, completeness, wasRunning);
tr_torrentSetDirty (tor); tr_torrentSetDirty (tor);
} }