mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2025-02-25 23:21:38 +01:00
remove the max_failures argument from download_status_is_ready.
This commit is contained in:
parent
5b55e15707
commit
b8ff7407a7
5 changed files with 15 additions and 36 deletions
|
@ -636,8 +636,7 @@ fetch_bridge_descriptors(const or_options_t *options, time_t now)
|
||||||
SMARTLIST_FOREACH_BEGIN(bridge_list, bridge_info_t *, bridge)
|
SMARTLIST_FOREACH_BEGIN(bridge_list, bridge_info_t *, bridge)
|
||||||
{
|
{
|
||||||
/* This resets the download status on first use */
|
/* This resets the download status on first use */
|
||||||
if (!download_status_is_ready(&bridge->fetch_status, now,
|
if (!download_status_is_ready(&bridge->fetch_status, now))
|
||||||
IMPOSSIBLE_TO_DOWNLOAD))
|
|
||||||
continue; /* don't bother, no need to retry yet */
|
continue; /* don't bother, no need to retry yet */
|
||||||
if (routerset_contains_bridge(options->ExcludeNodes, bridge)) {
|
if (routerset_contains_bridge(options->ExcludeNodes, bridge)) {
|
||||||
download_status_mark_impossible(&bridge->fetch_status);
|
download_status_mark_impossible(&bridge->fetch_status);
|
||||||
|
|
|
@ -132,18 +132,14 @@ time_t download_status_increment_attempt(download_status_t *dls,
|
||||||
time(NULL))
|
time(NULL))
|
||||||
|
|
||||||
void download_status_reset(download_status_t *dls);
|
void download_status_reset(download_status_t *dls);
|
||||||
static int download_status_is_ready(download_status_t *dls, time_t now,
|
static int download_status_is_ready(download_status_t *dls, time_t now);
|
||||||
int max_failures);
|
|
||||||
time_t download_status_get_next_attempt_at(const download_status_t *dls);
|
time_t download_status_get_next_attempt_at(const download_status_t *dls);
|
||||||
|
|
||||||
/** Return true iff, as of <b>now</b>, the resource tracked by <b>dls</b> is
|
/** Return true iff, as of <b>now</b>, the resource tracked by <b>dls</b> is
|
||||||
* ready to get its download reattempted. */
|
* ready to get its download reattempted. */
|
||||||
static inline int
|
static inline int
|
||||||
download_status_is_ready(download_status_t *dls, time_t now,
|
download_status_is_ready(download_status_t *dls, time_t now)
|
||||||
int max_failures)
|
|
||||||
{
|
{
|
||||||
(void) max_failures; // 23814 REMOVE
|
|
||||||
|
|
||||||
/* dls wasn't reset before it was used */
|
/* dls wasn't reset before it was used */
|
||||||
if (dls->next_attempt_at == 0) {
|
if (dls->next_attempt_at == 0) {
|
||||||
download_status_reset(dls);
|
download_status_reset(dls);
|
||||||
|
|
|
@ -920,8 +920,7 @@ microdesc_list_missing_digest256(networkstatus_t *ns, microdesc_cache_t *cache,
|
||||||
if (microdesc_cache_lookup_by_digest256(cache, rs->descriptor_digest))
|
if (microdesc_cache_lookup_by_digest256(cache, rs->descriptor_digest))
|
||||||
continue;
|
continue;
|
||||||
if (downloadable_only &&
|
if (downloadable_only &&
|
||||||
!download_status_is_ready(&rs->dl_status, now,
|
!download_status_is_ready(&rs->dl_status, now))
|
||||||
get_options()->TestingMicrodescMaxDownloadTries))
|
|
||||||
continue;
|
continue;
|
||||||
if (skip && digest256map_get(skip, (const uint8_t*)rs->descriptor_digest))
|
if (skip && digest256map_get(skip, (const uint8_t*)rs->descriptor_digest))
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -942,14 +942,11 @@ update_consensus_networkstatus_downloads(time_t now)
|
||||||
update_consensus_bootstrap_multiple_downloads(now, options);
|
update_consensus_bootstrap_multiple_downloads(now, options);
|
||||||
} else {
|
} else {
|
||||||
/* Check if we failed downloading a consensus too recently */
|
/* Check if we failed downloading a consensus too recently */
|
||||||
int max_dl_tries = options->TestingConsensusMaxDownloadTries;
|
|
||||||
|
|
||||||
/* Let's make sure we remembered to update consensus_dl_status */
|
/* Let's make sure we remembered to update consensus_dl_status */
|
||||||
tor_assert(consensus_dl_status[i].schedule == DL_SCHED_CONSENSUS);
|
tor_assert(consensus_dl_status[i].schedule == DL_SCHED_CONSENSUS);
|
||||||
|
|
||||||
if (!download_status_is_ready(&consensus_dl_status[i],
|
if (!download_status_is_ready(&consensus_dl_status[i], now)) {
|
||||||
now,
|
|
||||||
max_dl_tries)) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -976,17 +973,9 @@ update_consensus_networkstatus_downloads(time_t now)
|
||||||
static void
|
static void
|
||||||
update_consensus_bootstrap_attempt_downloads(
|
update_consensus_bootstrap_attempt_downloads(
|
||||||
time_t now,
|
time_t now,
|
||||||
const or_options_t *options,
|
|
||||||
download_status_t *dls,
|
download_status_t *dls,
|
||||||
download_want_authority_t want_authority)
|
download_want_authority_t want_authority)
|
||||||
{
|
{
|
||||||
int use_fallbacks = networkstatus_consensus_can_use_extra_fallbacks(options);
|
|
||||||
int max_dl_tries = options->ClientBootstrapConsensusMaxDownloadTries;
|
|
||||||
if (!use_fallbacks) {
|
|
||||||
max_dl_tries =
|
|
||||||
options->ClientBootstrapConsensusAuthorityOnlyMaxDownloadTries;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *resource = networkstatus_get_flavor_name(
|
const char *resource = networkstatus_get_flavor_name(
|
||||||
usable_consensus_flavor());
|
usable_consensus_flavor());
|
||||||
|
|
||||||
|
@ -995,7 +984,7 @@ update_consensus_bootstrap_attempt_downloads(
|
||||||
|
|
||||||
/* Allow for multiple connections in the same second, if the schedule value
|
/* Allow for multiple connections in the same second, if the schedule value
|
||||||
* is 0. */
|
* is 0. */
|
||||||
while (download_status_is_ready(dls, now, max_dl_tries)) {
|
while (download_status_is_ready(dls, now)) {
|
||||||
log_info(LD_DIR, "Launching %s bootstrap %s networkstatus consensus "
|
log_info(LD_DIR, "Launching %s bootstrap %s networkstatus consensus "
|
||||||
"download.", resource, (want_authority == DL_WANT_AUTHORITY
|
"download.", resource, (want_authority == DL_WANT_AUTHORITY
|
||||||
? "authority"
|
? "authority"
|
||||||
|
@ -1046,7 +1035,7 @@ update_consensus_bootstrap_multiple_downloads(time_t now,
|
||||||
|
|
||||||
if (!check_consensus_waiting_for_certs(usable_flavor, now, dls_f)) {
|
if (!check_consensus_waiting_for_certs(usable_flavor, now, dls_f)) {
|
||||||
/* During bootstrap, DL_WANT_ANY_DIRSERVER means "use fallbacks". */
|
/* During bootstrap, DL_WANT_ANY_DIRSERVER means "use fallbacks". */
|
||||||
update_consensus_bootstrap_attempt_downloads(now, options, dls_f,
|
update_consensus_bootstrap_attempt_downloads(now, dls_f,
|
||||||
DL_WANT_ANY_DIRSERVER);
|
DL_WANT_ANY_DIRSERVER);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1056,7 +1045,7 @@ update_consensus_bootstrap_multiple_downloads(time_t now,
|
||||||
&consensus_bootstrap_dl_status[CONSENSUS_BOOTSTRAP_SOURCE_AUTHORITY];
|
&consensus_bootstrap_dl_status[CONSENSUS_BOOTSTRAP_SOURCE_AUTHORITY];
|
||||||
|
|
||||||
if (!check_consensus_waiting_for_certs(usable_flavor, now, dls_a)) {
|
if (!check_consensus_waiting_for_certs(usable_flavor, now, dls_a)) {
|
||||||
update_consensus_bootstrap_attempt_downloads(now, options, dls_a,
|
update_consensus_bootstrap_attempt_downloads(now, dls_a,
|
||||||
DL_WANT_AUTHORITY);
|
DL_WANT_AUTHORITY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -177,7 +177,7 @@ static void download_status_reset_by_sk_in_cl(cert_list_t *cl,
|
||||||
const char *digest);
|
const char *digest);
|
||||||
static int download_status_is_ready_by_sk_in_cl(cert_list_t *cl,
|
static int download_status_is_ready_by_sk_in_cl(cert_list_t *cl,
|
||||||
const char *digest,
|
const char *digest,
|
||||||
time_t now, int max_failures);
|
time_t now);
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
||||||
|
@ -287,7 +287,7 @@ download_status_reset_by_sk_in_cl(cert_list_t *cl, const char *digest)
|
||||||
static int
|
static int
|
||||||
download_status_is_ready_by_sk_in_cl(cert_list_t *cl,
|
download_status_is_ready_by_sk_in_cl(cert_list_t *cl,
|
||||||
const char *digest,
|
const char *digest,
|
||||||
time_t now, int max_failures)
|
time_t now)
|
||||||
{
|
{
|
||||||
int rv = 0;
|
int rv = 0;
|
||||||
download_status_t *dlstatus = NULL;
|
download_status_t *dlstatus = NULL;
|
||||||
|
@ -304,7 +304,7 @@ download_status_is_ready_by_sk_in_cl(cert_list_t *cl,
|
||||||
/* Got one? */
|
/* Got one? */
|
||||||
if (dlstatus) {
|
if (dlstatus) {
|
||||||
/* Use download_status_is_ready() */
|
/* Use download_status_is_ready() */
|
||||||
rv = download_status_is_ready(dlstatus, now, max_failures);
|
rv = download_status_is_ready(dlstatus, now);
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
* If we don't know anything about it, return 1, since we haven't
|
* If we don't know anything about it, return 1, since we haven't
|
||||||
|
@ -1067,8 +1067,7 @@ authority_certs_fetch_missing(networkstatus_t *status, time_t now,
|
||||||
}
|
}
|
||||||
} SMARTLIST_FOREACH_END(cert);
|
} SMARTLIST_FOREACH_END(cert);
|
||||||
if (!found &&
|
if (!found &&
|
||||||
download_status_is_ready(&(cl->dl_status_by_id), now,
|
download_status_is_ready(&(cl->dl_status_by_id), now) &&
|
||||||
options->TestingCertMaxDownloadTries) &&
|
|
||||||
!digestmap_get(pending_id, ds->v3_identity_digest)) {
|
!digestmap_get(pending_id, ds->v3_identity_digest)) {
|
||||||
log_info(LD_DIR,
|
log_info(LD_DIR,
|
||||||
"No current certificate known for authority %s "
|
"No current certificate known for authority %s "
|
||||||
|
@ -1131,8 +1130,7 @@ authority_certs_fetch_missing(networkstatus_t *status, time_t now,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (download_status_is_ready_by_sk_in_cl(
|
if (download_status_is_ready_by_sk_in_cl(
|
||||||
cl, sig->signing_key_digest,
|
cl, sig->signing_key_digest, now) &&
|
||||||
now, options->TestingCertMaxDownloadTries) &&
|
|
||||||
!fp_pair_map_get_by_digests(pending_cert,
|
!fp_pair_map_get_by_digests(pending_cert,
|
||||||
voter->identity_digest,
|
voter->identity_digest,
|
||||||
sig->signing_key_digest)) {
|
sig->signing_key_digest)) {
|
||||||
|
@ -5166,8 +5164,7 @@ update_consensus_router_descriptor_downloads(time_t now, int is_vote,
|
||||||
++n_inprogress;
|
++n_inprogress;
|
||||||
continue; /* We have an in-progress download. */
|
continue; /* We have an in-progress download. */
|
||||||
}
|
}
|
||||||
if (!download_status_is_ready(&rs->dl_status, now,
|
if (!download_status_is_ready(&rs->dl_status, now)) {
|
||||||
options->TestingDescriptorMaxDownloadTries)) {
|
|
||||||
++n_delayed; /* Not ready for retry. */
|
++n_delayed; /* Not ready for retry. */
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -5343,8 +5340,7 @@ update_extrainfo_downloads(time_t now)
|
||||||
++n_have;
|
++n_have;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!download_status_is_ready(&sd->ei_dl_status, now,
|
if (!download_status_is_ready(&sd->ei_dl_status, now)) {
|
||||||
options->TestingDescriptorMaxDownloadTries)) {
|
|
||||||
++n_delay;
|
++n_delay;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue