diff --git a/libtransmission/announcer-udp.c b/libtransmission/announcer-udp.c index aebef22ac..4b905bdda 100644 --- a/libtransmission/announcer-udp.c +++ b/libtransmission/announcer-udp.c @@ -675,7 +675,7 @@ static bool tau_tracker_is_idle(struct tau_tracker const* tracker) return tr_ptrArrayEmpty(&tracker->announces) && tr_ptrArrayEmpty(&tracker->scrapes) && tracker->dns_request == NULL; } -static void tau_tracker_upkeep(struct tau_tracker* tracker) +static void tau_tracker_upkeep_ex(struct tau_tracker* tracker, bool timeout_reqs) { time_t const now = tr_time(); bool const closing = tracker->close_at != 0; @@ -727,7 +727,10 @@ static void 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) { @@ -735,6 +738,11 @@ static void tau_tracker_upkeep(struct tau_tracker* tracker) } } +static void tau_tracker_upkeep(struct tau_tracker* tracker) +{ + tau_tracker_upkeep_ex(tracker, true); +} + /**** ***** ***** SESSION @@ -982,7 +990,7 @@ void tr_tracker_udp_announce(tr_session* session, tr_announce_request const* req struct tau_tracker* tracker = tau_session_get_tracker(tau, request->url); struct tau_announce_request* r = tau_announce_request_new(request, response_func, user_data); tr_ptrArrayAppend(&tracker->announces, r); - tau_tracker_upkeep(tracker); + tau_tracker_upkeep_ex(tracker, false); } void tr_tracker_udp_scrape(tr_session* session, tr_scrape_request const* request, tr_scrape_response_func response_func, @@ -992,5 +1000,5 @@ void tr_tracker_udp_scrape(tr_session* session, tr_scrape_request const* request struct tau_tracker* tracker = tau_session_get_tracker(tau, request->url); struct tau_scrape_request* r = tau_scrape_request_new(request, response_func, user_data); tr_ptrArrayAppend(&tracker->scrapes, r); - tau_tracker_upkeep(tracker); + tau_tracker_upkeep_ex(tracker, false); } diff --git a/libtransmission/announcer.c b/libtransmission/announcer.c index 61c4971ea..0fd8cf6dc 100644 --- a/libtransmission/announcer.c +++ b/libtransmission/announcer.c @@ -1475,6 +1475,8 @@ static void multiscrape(tr_announcer* announcer, tr_ptrArray* tiers) uint8_t const* hash = tier->tor->info.hash; bool found = false; + TR_ASSERT(url != NULL); + /* if there's a request with this scrape URL and a free slot, use it */ for (int j = 0; !found && j < request_count; ++j) {