]> granicus.if.org Git - transmission/commitdiff
#5146 'seeding complete callback called twice': revert r13627 due to issues described...
authorJordan Lee <jordan@transmissionbt.com>
Sun, 27 Jan 2013 06:02:52 +0000 (06:02 +0000)
committerJordan Lee <jordan@transmissionbt.com>
Sun, 27 Jan 2013 06:02:52 +0000 (06:02 +0000)
libtransmission/torrent.c

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