mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-11 05:33:47 +01:00
simplify more -- we only call these funcs when bootstrapping
This commit is contained in:
parent
c98fbd4169
commit
d5a96286c2
@ -121,8 +121,7 @@ static int have_warned_about_new_version = 0;
|
|||||||
static void routerstatus_list_update_named_server_map(void);
|
static void routerstatus_list_update_named_server_map(void);
|
||||||
static void update_consensus_bootstrap_multiple_downloads(
|
static void update_consensus_bootstrap_multiple_downloads(
|
||||||
time_t now,
|
time_t now,
|
||||||
const or_options_t *options,
|
const or_options_t *options);
|
||||||
int we_are_bootstrapping);
|
|
||||||
|
|
||||||
/** Forget that we've warned about anything networkstatus-related, so we will
|
/** Forget that we've warned about anything networkstatus-related, so we will
|
||||||
* give fresh warnings if the same behavior happens again. */
|
* give fresh warnings if the same behavior happens again. */
|
||||||
@ -869,8 +868,7 @@ update_consensus_networkstatus_downloads(time_t now)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Make multiple connections for a bootstrap consensus download. */
|
/* Make multiple connections for a bootstrap consensus download. */
|
||||||
update_consensus_bootstrap_multiple_downloads(now, options,
|
update_consensus_bootstrap_multiple_downloads(now, options);
|
||||||
we_are_bootstrapping);
|
|
||||||
} else {
|
} else {
|
||||||
/* Check if we failed downloading a consensus too recently */
|
/* Check if we failed downloading a consensus too recently */
|
||||||
int max_dl_tries = consensus_max_download_tries(options,
|
int max_dl_tries = consensus_max_download_tries(options,
|
||||||
@ -909,12 +907,10 @@ static void
|
|||||||
update_consensus_bootstrap_attempt_downloads(
|
update_consensus_bootstrap_attempt_downloads(
|
||||||
time_t now,
|
time_t now,
|
||||||
const or_options_t *options,
|
const or_options_t *options,
|
||||||
int we_are_bootstrapping,
|
|
||||||
download_status_t *dls,
|
download_status_t *dls,
|
||||||
download_want_authority_t want_authority)
|
download_want_authority_t want_authority)
|
||||||
{
|
{
|
||||||
int max_dl_tries = consensus_max_download_tries(options,
|
int max_dl_tries = consensus_max_download_tries(options, 1);
|
||||||
we_are_bootstrapping);
|
|
||||||
const char *resource = networkstatus_get_flavor_name(
|
const char *resource = networkstatus_get_flavor_name(
|
||||||
usable_consensus_flavor());
|
usable_consensus_flavor());
|
||||||
|
|
||||||
@ -947,8 +943,7 @@ update_consensus_bootstrap_attempt_downloads(
|
|||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
update_consensus_bootstrap_multiple_downloads(time_t now,
|
update_consensus_bootstrap_multiple_downloads(time_t now,
|
||||||
const or_options_t *options,
|
const or_options_t *options)
|
||||||
int we_are_bootstrapping)
|
|
||||||
{
|
{
|
||||||
const int usable_flavor = usable_consensus_flavor();
|
const int usable_flavor = usable_consensus_flavor();
|
||||||
|
|
||||||
@ -957,12 +952,6 @@ update_consensus_bootstrap_multiple_downloads(time_t now,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we've managed to validate a usable consensus, don't make additional
|
|
||||||
* connections. */
|
|
||||||
if (!we_are_bootstrapping) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Launch concurrent consensus download attempt(s) based on the mirror and
|
/* Launch concurrent consensus download attempt(s) based on the mirror and
|
||||||
* authority schedules. Try the mirror first - this makes it slightly more
|
* authority schedules. Try the mirror first - this makes it slightly more
|
||||||
* likely that we'll connect to the fallback first, and then end the
|
* likely that we'll connect to the fallback first, and then end the
|
||||||
@ -981,8 +970,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,
|
update_consensus_bootstrap_attempt_downloads(now, options, dls_f,
|
||||||
we_are_bootstrapping, dls_f,
|
|
||||||
DL_WANT_ANY_DIRSERVER);
|
DL_WANT_ANY_DIRSERVER);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -992,8 +980,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,
|
update_consensus_bootstrap_attempt_downloads(now, options, dls_a,
|
||||||
we_are_bootstrapping, dls_a,
|
|
||||||
DL_WANT_AUTHORITY);
|
DL_WANT_AUTHORITY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user