use default member initializers instead of initialization lists in announce_entry (#1129)
This commit is contained in:
parent
c7ec987a1b
commit
885e4f8fc4
|
@ -79,10 +79,10 @@ namespace libtorrent
|
||||||
int min_announce_in() const;
|
int min_announce_in() const;
|
||||||
|
|
||||||
// the time of next tracker announce
|
// the time of next tracker announce
|
||||||
time_point next_announce;
|
time_point next_announce = min_time();
|
||||||
|
|
||||||
// no announces before this time
|
// no announces before this time
|
||||||
time_point min_announce;
|
time_point min_announce = min_time();
|
||||||
|
|
||||||
// TODO: include the number of peers received from this tracker, at last
|
// TODO: include the number of peers received from this tracker, at last
|
||||||
// announce
|
// announce
|
||||||
|
@ -97,16 +97,16 @@ namespace libtorrent
|
||||||
// if this tracker has returned scrape data, these fields are filled in
|
// if this tracker has returned scrape data, these fields are filled in
|
||||||
// with valid numbers. Otherwise they are set to -1. the number of
|
// with valid numbers. Otherwise they are set to -1. the number of
|
||||||
// current downloaders
|
// current downloaders
|
||||||
int scrape_incomplete;
|
int scrape_incomplete = -1;
|
||||||
int scrape_complete;
|
int scrape_complete = -1;
|
||||||
int scrape_downloaded;
|
int scrape_downloaded = -1;
|
||||||
|
|
||||||
// the tier this tracker belongs to
|
// the tier this tracker belongs to
|
||||||
std::uint8_t tier;
|
std::uint8_t tier = 0;
|
||||||
|
|
||||||
// the max number of failures to announce to this tracker in
|
// the max number of failures to announce to this tracker in
|
||||||
// a row, before this tracker is not used anymore. 0 means unlimited
|
// a row, before this tracker is not used anymore. 0 means unlimited
|
||||||
std::uint8_t fail_limit;
|
std::uint8_t fail_limit = 0;
|
||||||
|
|
||||||
// the number of times in a row we have failed to announce to this
|
// the number of times in a row we have failed to announce to this
|
||||||
// tracker.
|
// tracker.
|
||||||
|
|
|
@ -49,13 +49,6 @@ namespace libtorrent
|
||||||
|
|
||||||
announce_entry::announce_entry(std::string const& u)
|
announce_entry::announce_entry(std::string const& u)
|
||||||
: url(u)
|
: url(u)
|
||||||
, next_announce(min_time())
|
|
||||||
, min_announce(min_time())
|
|
||||||
, scrape_incomplete(-1)
|
|
||||||
, scrape_complete(-1)
|
|
||||||
, scrape_downloaded(-1)
|
|
||||||
, tier(0)
|
|
||||||
, fail_limit(0)
|
|
||||||
, fails(0)
|
, fails(0)
|
||||||
, updating(false)
|
, updating(false)
|
||||||
, source(0)
|
, source(0)
|
||||||
|
@ -66,14 +59,7 @@ namespace libtorrent
|
||||||
{}
|
{}
|
||||||
|
|
||||||
announce_entry::announce_entry()
|
announce_entry::announce_entry()
|
||||||
: next_announce(min_time())
|
: fails(0)
|
||||||
, min_announce(min_time())
|
|
||||||
, scrape_incomplete(-1)
|
|
||||||
, scrape_complete(-1)
|
|
||||||
, scrape_downloaded(-1)
|
|
||||||
, tier(0)
|
|
||||||
, fail_limit(0)
|
|
||||||
, fails(0)
|
|
||||||
, updating(false)
|
, updating(false)
|
||||||
, source(0)
|
, source(0)
|
||||||
, verified(false)
|
, verified(false)
|
||||||
|
@ -104,10 +90,9 @@ namespace libtorrent
|
||||||
// 7, 15, 27, 45, 95, 127, 165, ... seconds
|
// 7, 15, 27, 45, 95, 127, 165, ... seconds
|
||||||
// with the default tracker_backoff of 250
|
// with the default tracker_backoff of 250
|
||||||
int const tracker_backoff_seconds = total_seconds(tracker_backoff);
|
int const tracker_backoff_seconds = total_seconds(tracker_backoff);
|
||||||
int delay = (std::min)(tracker_retry_delay_min + int(fails) * int(fails)
|
int const delay = std::max(std::min(tracker_retry_delay_min + int(fails) * int(fails)
|
||||||
* tracker_retry_delay_min * tracker_backoff_seconds / 100
|
* tracker_retry_delay_min * tracker_backoff_seconds / 100
|
||||||
, int(tracker_retry_delay_max));
|
, int(tracker_retry_delay_max)), retry_interval);
|
||||||
delay = (std::max)(delay, retry_interval);
|
|
||||||
next_announce = aux::time_now() + seconds(delay);
|
next_announce = aux::time_now() + seconds(delay);
|
||||||
updating = false;
|
updating = false;
|
||||||
}
|
}
|
||||||
|
@ -116,7 +101,7 @@ namespace libtorrent
|
||||||
{
|
{
|
||||||
// if we're a seed and we haven't sent a completed
|
// if we're a seed and we haven't sent a completed
|
||||||
// event, we need to let this announce through
|
// event, we need to let this announce through
|
||||||
bool need_send_complete = is_seed && !complete_sent;
|
bool const need_send_complete = is_seed && !complete_sent;
|
||||||
|
|
||||||
return now >= next_announce
|
return now >= next_announce
|
||||||
&& (now >= min_announce || need_send_complete)
|
&& (now >= min_announce || need_send_complete)
|
||||||
|
|
Loading…
Reference in New Issue