]> granicus.if.org Git - transmission/commitdiff
#903: "1.11: Not making use of Tier 2 tracker on Tier 1 error"
authorCharles Kerr <charles@transmissionbt.com>
Tue, 29 Apr 2008 01:21:42 +0000 (01:21 +0000)
committerCharles Kerr <charles@transmissionbt.com>
Tue, 29 Apr 2008 01:21:42 +0000 (01:21 +0000)
libtransmission/tracker.c

index a97f7bf5310ca93fc6aaa35d567727849075ca8a..c49032ec6cadbc20b40a22a92db3ac69b3e3b3da 100644 (file)
@@ -225,11 +225,14 @@ publishNewPeers( tr_tracker * t, int allAreSeeds,
 static void onReqDone( tr_session * session );
 
 static void
-updateAddresses( tr_tracker * t, long response_code, int * tryAgain )
+updateAddresses( tr_tracker  * t,
+                 long          response_code,
+                 int           moveToNextAddress,
+                 int         * tryAgain )
 {
-    int moveToNextAddress = FALSE;
     tr_torrent * torrent = tr_torrentFindFromHash( t->session, t->hash );
 
+
     if( !response_code ) /* tracker didn't respond */
     {
         tr_ninf( t->name, _( "Tracker hasn't responded yet.  Retrying..." ) );
@@ -254,7 +257,6 @@ updateAddresses( tr_tracker * t, long response_code, int * tryAgain )
     }
 
     *tryAgain = moveToNextAddress;
-
     if( moveToNextAddress )
     {
         if ( ++t->trackerIndex >= torrent->info.trackerCount ) /* we've tried them all */
@@ -326,6 +328,7 @@ onTrackerResponse( tr_session    * session,
                    size_t          responseLen,
                    void          * torrent_hash )
 {
+    int moveToNextAddress = FALSE;
     int tryAgain;
     tr_tracker * t;
 
@@ -351,8 +354,11 @@ onTrackerResponse( tr_session    * session,
             int incomplete = -1;
             const char * str;
 
-            if(( tr_bencDictFindStr( &benc, "failure reason", &str )))
-                publishErrorMessageAndStop( t, str );
+            if(( tr_bencDictFindStr( &benc, "failure reason", &str ))) {
+               // publishErrorMessageAndStop( t, str );
+                moveToNextAddress = TRUE;
+                publishMessage( t, str, TR_TRACKER_ERROR );
+            }
 
             if(( tr_bencDictFindStr( &benc, "warning message", &str )))
                 publishWarning( t, str );
@@ -398,7 +404,7 @@ onTrackerResponse( tr_session    * session,
             tr_bencFree( &benc );
     }
 
-    updateAddresses( t, responseCode, &tryAgain );
+    updateAddresses( t, responseCode, moveToNextAddress, &tryAgain );
 
     /**
     ***
@@ -459,6 +465,7 @@ onScrapeResponse( tr_session   * session,
                   size_t         responseLen,
                   void         * torrent_hash )
 {
+    int moveToNextAddress = FALSE;
     int tryAgain;
     tr_tracker * t;
 
@@ -510,12 +517,14 @@ onScrapeResponse( tr_session   * session,
                 t->retryScrapeIntervalSec = 30;
             }
         }
+        else
+            moveToNextAddress = TRUE;
 
         if( bencLoaded )
             tr_bencFree( &benc );
     }
 
-    updateAddresses( t, responseCode, &tryAgain );
+    updateAddresses( t, responseCode, moveToNextAddress, &tryAgain );
 
     /**
     ***