diff --git a/libtransmission/announcer.cc b/libtransmission/announcer.cc index 69aa96c0a..8c14857ca 100644 --- a/libtransmission/announcer.cc +++ b/libtransmission/announcer.cc @@ -927,6 +927,15 @@ struct announce_data bool is_running_on_success = false; }; +static bool isUnregistered(char const* errmsg) +{ + auto const lower = tr_strlower(errmsg != nullptr ? errmsg : ""); + + auto constexpr Keys = std::array{ "unregistered torrent"sv, "torrent not registered"sv }; + + return std::any_of(std::begin(Keys), std::end(Keys), [&lower](auto const& key) { return tr_strvContains(lower, key); }); +} + static void on_announce_error(tr_tier* tier, char const* err, tr_announce_event e) { /* increment the error count */ @@ -942,12 +951,20 @@ static void on_announce_error(tr_tier* tier, char const* err, tr_announce_event /* switch to the next tracker */ current_tracker = tier->useNextTracker(); - /* schedule a reannounce */ - int const interval = current_tracker->getRetryInterval(); auto const* const host_cstr = current_tracker->host.c_str(); - dbgmsg(tier, "Tracker '%s' announce error: %s (Retrying in %d seconds)", host_cstr, err, interval); - tr_logAddTorInfo(tier->tor, "Tracker '%s' announce error: %s (Retrying in %d seconds)", host_cstr, err, interval); - tier_announce_event_push(tier, e, tr_time() + interval); + if (isUnregistered(err)) + { + dbgmsg(tier, "Tracker '%s' announce error: %s", host_cstr, err); + tr_logAddTorInfo(tier->tor, "Tracker '%s' announce error: %s", host_cstr, err); + } + else + { + /* schedule a reannounce */ + int const interval = current_tracker->getRetryInterval(); + dbgmsg(tier, "Tracker '%s' announce error: %s (Retrying in %d seconds)", host_cstr, err, interval); + tr_logAddTorInfo(tier->tor, "Tracker '%s' announce error: %s (Retrying in %d seconds)", host_cstr, err, interval); + tier_announce_event_push(tier, e, tr_time() + interval); + } } static void on_announce_done(tr_announce_response const* response, void* vdata)