mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-20 10:12:15 +01:00
Report bootstrapping progress correctly when downloading microdescs
We had updated our "do we have enough microdescs to begin building circuits?" logic most recently in 0.2.4.10-alpha (see bug 5956), but we left the bootstrap status event logic at "how far through getting 1/4 of them are we?" Fixes bug 9958; bugfix on 0.2.2.36, which is where they diverged (see bug 5343).
This commit is contained in:
parent
78251e004f
commit
f96a8d5fa3
8
changes/bug9958
Normal file
8
changes/bug9958
Normal file
@ -0,0 +1,8 @@
|
||||
o Minor bugfixes:
|
||||
- Report bootstrapping progress correctly when we're downloading
|
||||
microdescriptors. We had updated our "do we have enough microdescs
|
||||
to begin building circuits?" logic most recently in 0.2.4.10-alpha
|
||||
(see bug 5956), but we left the bootstrap status event logic at
|
||||
"how far through getting 1/4 of them are we?" Fixes bug 9958;
|
||||
bugfix on 0.2.2.36, which is where they diverged (see bug 5343).
|
||||
|
@ -25,6 +25,8 @@
|
||||
static void nodelist_drop_node(node_t *node, int remove_from_ht);
|
||||
static void node_free(node_t *node);
|
||||
static void update_router_have_minimum_dir_info(void);
|
||||
static double get_frac_paths_needed_for_circs(const or_options_t *options,
|
||||
const networkstatus_t *ns);
|
||||
|
||||
/** A nodelist_t holds a node_t object for every router we're "willing to use
|
||||
* for something". Specifically, it should hold a node_t for every node that
|
||||
@ -1317,7 +1319,7 @@ count_usable_descriptors(int *num_present, int *num_usable,
|
||||
md ? "microdesc" : "desc", exit_only ? " exits" : "s");
|
||||
}
|
||||
|
||||
/** Return an extimate of which fraction of usable paths through the Tor
|
||||
/** Return an estimate of which fraction of usable paths through the Tor
|
||||
* network we have available for use. */
|
||||
static double
|
||||
compute_frac_paths_available(const networkstatus_t *consensus,
|
||||
@ -1372,13 +1374,14 @@ compute_frac_paths_available(const networkstatus_t *consensus,
|
||||
if (f_myexit < f_exit)
|
||||
f_exit = f_myexit;
|
||||
|
||||
tor_asprintf(status_out,
|
||||
"%d%% of guards bw, "
|
||||
"%d%% of midpoint bw, and "
|
||||
"%d%% of exit bw",
|
||||
(int)(f_guard*100),
|
||||
(int)(f_mid*100),
|
||||
(int)(f_exit*100));
|
||||
if (status_out)
|
||||
tor_asprintf(status_out,
|
||||
"%d%% of guards bw, "
|
||||
"%d%% of midpoint bw, and "
|
||||
"%d%% of exit bw",
|
||||
(int)(f_guard*100),
|
||||
(int)(f_mid*100),
|
||||
(int)(f_exit*100));
|
||||
|
||||
return f_guard * f_mid * f_exit;
|
||||
}
|
||||
@ -1391,19 +1394,19 @@ count_loading_descriptors_progress(void)
|
||||
{
|
||||
int num_present = 0, num_usable=0;
|
||||
time_t now = time(NULL);
|
||||
const or_options_t *options = get_options();
|
||||
const networkstatus_t *consensus =
|
||||
networkstatus_get_reasonably_live_consensus(now,usable_consensus_flavor());
|
||||
double fraction;
|
||||
double paths, fraction;
|
||||
|
||||
if (!consensus)
|
||||
return 0; /* can't count descriptors if we have no list of them */
|
||||
|
||||
count_usable_descriptors(&num_present, &num_usable, NULL,
|
||||
consensus, get_options(), now, NULL, 0);
|
||||
paths = compute_frac_paths_available(consensus, options, now,
|
||||
&num_present, &num_usable,
|
||||
NULL);
|
||||
|
||||
if (num_usable == 0)
|
||||
return 0; /* don't div by 0 */
|
||||
fraction = num_present / (num_usable/4.);
|
||||
fraction = paths / get_frac_paths_needed_for_circs(options,consensus);
|
||||
if (fraction > 1.0)
|
||||
return 0; /* it's not the number of descriptors holding us back */
|
||||
return BOOTSTRAP_STATUS_LOADING_DESCRIPTORS + (int)
|
||||
|
Loading…
Reference in New Issue
Block a user