mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-28 14:23:30 +01:00
fix typos/etc before i go nuts on #18809
This commit is contained in:
parent
03fc4cf04c
commit
ce8266d52d
@ -3703,7 +3703,7 @@ connection_dir_would_close_consensus_conn_helper(void)
|
|||||||
* consensus, and we are still bootstrapping (that is, we have no usable
|
* consensus, and we are still bootstrapping (that is, we have no usable
|
||||||
* consensus), we don't want to close any until one starts downloading. */
|
* consensus), we don't want to close any until one starts downloading. */
|
||||||
if (!networkstatus_consensus_is_downloading_usable_flavor()
|
if (!networkstatus_consensus_is_downloading_usable_flavor()
|
||||||
&& networkstatus_consensus_is_boostrapping(time(NULL))) {
|
&& networkstatus_consensus_is_bootstrapping(time(NULL))) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3737,7 +3737,7 @@ connection_dir_avoid_extra_connection_for_purpose(unsigned int purpose)
|
|||||||
* bootstrapping (that is, we have no usable consensus), we can be sure that
|
* bootstrapping (that is, we have no usable consensus), we can be sure that
|
||||||
* any further connections would be excess. */
|
* any further connections would be excess. */
|
||||||
if (networkstatus_consensus_is_downloading_usable_flavor()
|
if (networkstatus_consensus_is_downloading_usable_flavor()
|
||||||
&& networkstatus_consensus_is_boostrapping(time(NULL))) {
|
&& networkstatus_consensus_is_bootstrapping(time(NULL))) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3778,12 +3778,12 @@ connection_dir_close_consensus_conn_if_extra(dir_connection_t *conn)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const int we_are_bootstrapping = networkstatus_consensus_is_boostrapping(
|
const int we_are_bootstrapping = networkstatus_consensus_is_bootstrapping(
|
||||||
time(NULL));
|
time(NULL));
|
||||||
|
|
||||||
/* We don't want to check other connections to see if they are downloading,
|
/* We don't want to check other connections to see if they are downloading,
|
||||||
* as this is prone to race-conditions. So leave it for
|
* as this is prone to race-conditions. So leave it for
|
||||||
* connection_dir_consider_close_extra_consensus_conns() to clean up.
|
* connection_dir_close_extra_consensus_conns(() to clean up.
|
||||||
*
|
*
|
||||||
* But if conn has just started connecting, or we have a consensus already,
|
* But if conn has just started connecting, or we have a consensus already,
|
||||||
* we can be sure it's not needed any more. */
|
* we can be sure it's not needed any more. */
|
||||||
@ -3823,7 +3823,7 @@ connection_dir_close_extra_consensus_conns(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int we_are_bootstrapping = networkstatus_consensus_is_boostrapping(
|
int we_are_bootstrapping = networkstatus_consensus_is_bootstrapping(
|
||||||
time(NULL));
|
time(NULL));
|
||||||
|
|
||||||
const char *usable_resource = networkstatus_get_flavor_name(
|
const char *usable_resource = networkstatus_get_flavor_name(
|
||||||
@ -3932,7 +3932,7 @@ find_dl_schedule(download_status_t *dls, const or_options_t *options)
|
|||||||
const int dir_server = dir_server_mode(options);
|
const int dir_server = dir_server_mode(options);
|
||||||
const int multi_d = networkstatus_consensus_can_use_multiple_directories(
|
const int multi_d = networkstatus_consensus_can_use_multiple_directories(
|
||||||
options);
|
options);
|
||||||
const int we_are_bootstrapping = networkstatus_consensus_is_boostrapping(
|
const int we_are_bootstrapping = networkstatus_consensus_is_bootstrapping(
|
||||||
time(NULL));
|
time(NULL));
|
||||||
const int use_fallbacks = networkstatus_consensus_can_use_extra_fallbacks(
|
const int use_fallbacks = networkstatus_consensus_can_use_extra_fallbacks(
|
||||||
options);
|
options);
|
||||||
|
@ -1917,7 +1917,7 @@ fetch_networkstatus_callback(time_t now, const or_options_t *options)
|
|||||||
|
|
||||||
/* How often do we check whether we should download network status
|
/* How often do we check whether we should download network status
|
||||||
* documents? */
|
* documents? */
|
||||||
const int we_are_bootstrapping = networkstatus_consensus_is_boostrapping(
|
const int we_are_bootstrapping = networkstatus_consensus_is_bootstrapping(
|
||||||
now);
|
now);
|
||||||
const int prefer_mirrors = !directory_fetches_from_authorities(
|
const int prefer_mirrors = !directory_fetches_from_authorities(
|
||||||
get_options());
|
get_options());
|
||||||
|
@ -819,7 +819,7 @@ update_consensus_networkstatus_downloads(time_t now)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
const or_options_t *options = get_options();
|
const or_options_t *options = get_options();
|
||||||
const int we_are_bootstrapping = networkstatus_consensus_is_boostrapping(
|
const int we_are_bootstrapping = networkstatus_consensus_is_bootstrapping(
|
||||||
now);
|
now);
|
||||||
const int use_multi_conn =
|
const int use_multi_conn =
|
||||||
networkstatus_consensus_can_use_multiple_directories(options);
|
networkstatus_consensus_can_use_multiple_directories(options);
|
||||||
@ -875,12 +875,13 @@ update_consensus_networkstatus_downloads(time_t now)
|
|||||||
resource,
|
resource,
|
||||||
DIR_CONN_STATE_CONNECTING);
|
DIR_CONN_STATE_CONNECTING);
|
||||||
|
|
||||||
if (i == usable_consensus_flavor()
|
/* If not all connections are "connecting", then some are
|
||||||
&& connect_consens_conn_count < consens_conn_count) {
|
* downloading. We want to have at most one downloading at a time. */
|
||||||
|
if (connect_consens_conn_count < consens_conn_count) {
|
||||||
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);
|
we_are_bootstrapping);
|
||||||
} else {
|
} else {
|
||||||
@ -954,7 +955,7 @@ update_consensus_bootstrap_attempt_downloads(
|
|||||||
* connections.
|
* connections.
|
||||||
* Only call when bootstrapping, and when we want to make additional
|
* Only call when bootstrapping, and when we want to make additional
|
||||||
* connections. Only nodes that satisfy
|
* connections. Only nodes that satisfy
|
||||||
* networkstatus_consensus_can_use_multiple_directories make additonal
|
* networkstatus_consensus_can_use_multiple_directories make additional
|
||||||
* connections.
|
* connections.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
@ -969,7 +970,7 @@ update_consensus_bootstrap_multiple_downloads(time_t now,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we've managed to validate a usable consensus, don't make additonal
|
/* If we've managed to validate a usable consensus, don't make additional
|
||||||
* connections. */
|
* connections. */
|
||||||
if (!we_are_bootstrapping) {
|
if (!we_are_bootstrapping) {
|
||||||
return;
|
return;
|
||||||
@ -1277,7 +1278,7 @@ networkstatus_get_reasonably_live_consensus(time_t now, int flavor)
|
|||||||
* only using the authorities and fallback directory mirrors to download the
|
* only using the authorities and fallback directory mirrors to download the
|
||||||
* consensus flavour we'll use. */
|
* consensus flavour we'll use. */
|
||||||
int
|
int
|
||||||
networkstatus_consensus_is_boostrapping(time_t now)
|
networkstatus_consensus_is_bootstrapping(time_t now)
|
||||||
{
|
{
|
||||||
/* If we don't have a consensus, we must still be bootstrapping */
|
/* If we don't have a consensus, we must still be bootstrapping */
|
||||||
return !networkstatus_get_reasonably_live_consensus(
|
return !networkstatus_get_reasonably_live_consensus(
|
||||||
@ -1327,7 +1328,7 @@ networkstatus_consensus_can_use_extra_fallbacks(const or_options_t *options)
|
|||||||
* return value of this function to see if a client could make multiple
|
* return value of this function to see if a client could make multiple
|
||||||
* bootstrap connections. Use
|
* bootstrap connections. Use
|
||||||
* networkstatus_consensus_can_use_multiple_directories()
|
* networkstatus_consensus_can_use_multiple_directories()
|
||||||
* and networkstatus_consensus_is_boostrapping(). */
|
* and networkstatus_consensus_is_bootstrapping(). */
|
||||||
int
|
int
|
||||||
networkstatus_consensus_has_excess_connections(void)
|
networkstatus_consensus_has_excess_connections(void)
|
||||||
{
|
{
|
||||||
|
@ -70,7 +70,7 @@ MOCK_DECL(networkstatus_t *,networkstatus_get_latest_consensus_by_flavor,
|
|||||||
networkstatus_t *networkstatus_get_live_consensus(time_t now);
|
networkstatus_t *networkstatus_get_live_consensus(time_t now);
|
||||||
networkstatus_t *networkstatus_get_reasonably_live_consensus(time_t now,
|
networkstatus_t *networkstatus_get_reasonably_live_consensus(time_t now,
|
||||||
int flavor);
|
int flavor);
|
||||||
int networkstatus_consensus_is_boostrapping(time_t now);
|
int networkstatus_consensus_is_bootstrapping(time_t now);
|
||||||
int networkstatus_consensus_can_use_multiple_directories(
|
int networkstatus_consensus_can_use_multiple_directories(
|
||||||
const or_options_t *options);
|
const or_options_t *options);
|
||||||
int networkstatus_consensus_can_use_extra_fallbacks(
|
int networkstatus_consensus_can_use_extra_fallbacks(
|
||||||
|
@ -705,7 +705,7 @@ test_conn_download_status(void *arg)
|
|||||||
|
|
||||||
/* now try closing the one that isn't downloading:
|
/* now try closing the one that isn't downloading:
|
||||||
* these tests won't work unless tor thinks it is bootstrapping */
|
* these tests won't work unless tor thinks it is bootstrapping */
|
||||||
tt_assert(networkstatus_consensus_is_boostrapping(time(NULL)));
|
tt_assert(networkstatus_consensus_is_bootstrapping(time(NULL)));
|
||||||
|
|
||||||
tt_assert(connection_dir_count_by_purpose_and_resource(
|
tt_assert(connection_dir_count_by_purpose_and_resource(
|
||||||
TEST_CONN_RSRC_PURPOSE,
|
TEST_CONN_RSRC_PURPOSE,
|
||||||
|
Loading…
Reference in New Issue
Block a user