mirror of
https://github.com/transmission/transmission
synced 2024-12-23 16:24:02 +00:00
parent
d46fdda9ea
commit
a86266d3c2
2 changed files with 14 additions and 4 deletions
|
@ -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;
|
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();
|
time_t const now = tr_time();
|
||||||
bool const closing = tracker->close_at != 0;
|
bool const closing = tracker->close_at != 0;
|
||||||
|
@ -727,7 +727,10 @@ static void tau_tracker_upkeep(struct tau_tracker* tracker)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (timeout_reqs)
|
||||||
|
{
|
||||||
tau_tracker_timeout_reqs(tracker);
|
tau_tracker_timeout_reqs(tracker);
|
||||||
|
}
|
||||||
|
|
||||||
if (tracker->addr != NULL && tracker->connection_expiration_time > now)
|
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
|
***** 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_tracker* tracker = tau_session_get_tracker(tau, request->url);
|
||||||
struct tau_announce_request* r = tau_announce_request_new(request, response_func, user_data);
|
struct tau_announce_request* r = tau_announce_request_new(request, response_func, user_data);
|
||||||
tr_ptrArrayAppend(&tracker->announces, r);
|
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,
|
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_tracker* tracker = tau_session_get_tracker(tau, request->url);
|
||||||
struct tau_scrape_request* r = tau_scrape_request_new(request, response_func, user_data);
|
struct tau_scrape_request* r = tau_scrape_request_new(request, response_func, user_data);
|
||||||
tr_ptrArrayAppend(&tracker->scrapes, r);
|
tr_ptrArrayAppend(&tracker->scrapes, r);
|
||||||
tau_tracker_upkeep(tracker);
|
tau_tracker_upkeep_ex(tracker, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1475,6 +1475,8 @@ static void multiscrape(tr_announcer* announcer, tr_ptrArray* tiers)
|
||||||
uint8_t const* hash = tier->tor->info.hash;
|
uint8_t const* hash = tier->tor->info.hash;
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
|
||||||
|
TR_ASSERT(url != NULL);
|
||||||
|
|
||||||
/* if there's a request with this scrape URL and a free slot, use it */
|
/* if there's a request with this scrape URL and a free slot, use it */
|
||||||
for (int j = 0; !found && j < request_count; ++j)
|
for (int j = 0; !found && j < request_count; ++j)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue