]> granicus.if.org Git - transmission/commitdiff
(trunk libT) #2199: DHT should not announce stopped torrents
authorCharles Kerr <charles@transmissionbt.com>
Thu, 11 Jun 2009 21:42:59 +0000 (21:42 +0000)
committerCharles Kerr <charles@transmissionbt.com>
Thu, 11 Jun 2009 21:42:59 +0000 (21:42 +0000)
libtransmission/torrent.c
libtransmission/tracker.c

index c50f2638fdd4d456c724795403efb0c4557db22c..4cc95e20d69020fa703bb91933e64a35fc18d256 100644 (file)
@@ -1274,6 +1274,8 @@ torrentStart( tr_torrent * tor, int reloadProgress )
 
         if( !isVerifying )
             tr_verifyAdd( tor, checkAndStartCB );
+
+        tor->dhtAnnounceAt = time( NULL ) tr_cryptoWeakRandInt( 20 );
     }
 
     tr_globalUnlock( tor->session );
index 0863b4341117968b465e9031ce0100f8e37d0767..5027c4ad2a75ff031d27e097aebbf26d151fbc21 100644 (file)
@@ -979,7 +979,7 @@ trackerPulse( void * vsession )
 
         if( tor->dhtAnnounceAt <= now ) {
             int rc = 1;
-            if( tr_torrentAllowsDHT(tor) )
+            if( tor->isRunning && tr_torrentAllowsDHT(tor) )
                 rc = tr_dhtAnnounce(tor, 1);
             if(rc == 0)
                 /* The DHT is not ready yet.  Try again soon. */