]> granicus.if.org Git - transmission/commitdiff
Don't switch trackers while announcing
authorMike Gelfand <mikedld@mikedld.com>
Tue, 4 Jul 2017 18:22:26 +0000 (21:22 +0300)
committerMike Gelfand <mikedld@mikedld.com>
Tue, 16 Jan 2018 22:09:07 +0000 (01:09 +0300)
Fixes: #297
libtransmission/announcer-udp.c
libtransmission/announcer.c

index 3b7c41341c61823b6140231725b36d18050e9ed3..3e573c65a864150b2184472ed845f24fd015a278 100644 (file)
@@ -659,7 +659,8 @@ tau_tracker_is_idle (const struct tau_tracker * tracker)
 }
 
 static void
-tau_tracker_upkeep (struct tau_tracker * tracker)
+tau_tracker_upkeep_ex (struct tau_tracker * tracker,
+                       bool                 timeout_reqs)
 {
     const time_t now = tr_time ();
     const bool closing = tracker->close_at != 0;
@@ -717,12 +718,19 @@ tau_tracker_upkeep (struct tau_tracker * tracker)
         return;
     }
 
-    tau_tracker_timeout_reqs (tracker);
+    if (timeout_reqs)
+      tau_tracker_timeout_reqs (tracker);
 
     if ((tracker->addr != NULL) && (tracker->connection_expiration_time > now))
         tau_tracker_send_reqs (tracker);
 }
 
+static void
+tau_tracker_upkeep (struct tau_tracker * tracker)
+{
+    tau_tracker_upkeep_ex (tracker, true);
+}
+
 /****
 *****
 *****  SESSION
@@ -957,7 +965,7 @@ tr_tracker_udp_announce (tr_session                 * session,
                                                                 response_func,
                                                                 user_data);
     tr_ptrArrayAppend (&tracker->announces, r);
-    tau_tracker_upkeep (tracker);
+    tau_tracker_upkeep_ex (tracker, false);
 }
 
 void
@@ -972,5 +980,5 @@ tr_tracker_udp_scrape (tr_session               * session,
                                                             response_func,
                                                             user_data);
     tr_ptrArrayAppend (&tracker->scrapes, r);
-    tau_tracker_upkeep (tracker);
+    tau_tracker_upkeep_ex (tracker, false);
 }
index eeffbb81e1094422b06f9c0d3e16fa9977955b7b..35e1f49ba593df3aca19c99af5f4240bdf1137e1 100644 (file)
@@ -1425,6 +1425,8 @@ multiscrape (tr_announcer * announcer, tr_ptrArray * tiers)
         char * url = tier->currentTracker->scrape;
         const uint8_t * hash = tier->tor->info.hash;
 
+        assert (url != NULL);
+
         /* if there's a request with this scrape URL and a free slot, use it */
         for (j=0; j<request_count; ++j)
         {