commit 8eb3d81e6e82f056f3c733b898388b8258dc12fd Author: Nick Mathewson nickm@torproject.org Date: Tue Feb 17 12:07:24 2015 -0500
Fix some issues with reporting exit-free networks
Fixes bug 14918. --- changes/bug14918 | 7 +++++++ src/or/nodelist.c | 23 ++++++++++++++--------- 2 files changed, 21 insertions(+), 9 deletions(-)
diff --git a/changes/bug14918 b/changes/bug14918 new file mode 100644 index 0000000..8e196cc --- /dev/null +++ b/changes/bug14918 @@ -0,0 +1,7 @@ + o Minor bugfixes (path counting): + - When deciding whether we have any exit nodes, count the number listed + in the consensus, not the number we have descriptors for. Fixes part + of bug 14918; bugfix on 0.2.6.2-alpha. + - Do not warn that we are missing directory information if we have + decided not to fetch directory information due to a long period + of idleness. Fixes part of bug 14918; bugfix on 0.2.6.2-alpha. diff --git a/src/or/nodelist.c b/src/or/nodelist.c index 249c198..b20de81 100644 --- a/src/or/nodelist.c +++ b/src/or/nodelist.c @@ -1354,9 +1354,10 @@ get_dir_info_status_string(void) }
/** Iterate over the servers listed in <b>consensus</b>, and count how many of - * them seem like ones we'd use, and how many of <em>those</em> we have - * descriptors for. Store the former in *<b>num_usable</b> and the latter in - * *<b>num_present</b>. + * them seem like ones we'd use (store this in *<b>num_usable</b>), and how + * many of <em>those</em> we have descriptors for (store this in + * *<b>num_present</b>). + * * If <b>in_set</b> is non-NULL, only consider those routers in <b>in_set</b>. * If <b>exit_only</b> is USABLE_DESCRIPTOR_EXIT_ONLY, only consider nodes * with the Exit flag. @@ -1409,10 +1410,11 @@ count_usable_descriptors(int *num_present, int *num_usable, }
/** Return an estimate of which fraction of usable paths through the Tor - * network we have available for use. - * Count how many routers seem like ones we'd use, and how many of - * <em>those</em> we have descriptors for. Store the former in - * *<b>num_usable_out</b> and the latter in *<b>num_present_out</b>. + * network we have available for use. Count how many routers seem like ones + * we'd use (store this in *<b>num_usable_out</b>), and how many of + * <em>those</em> we have descriptors for (store this in + * *<b>num_present_out</b>.) + * * If **<b>status_out</b> is present, allocate a new string and print the * available percentages of guard, middle, and exit nodes to it, noting * whether there are exits in the consensus. @@ -1475,7 +1477,7 @@ compute_frac_paths_available(const networkstatus_t *consensus, * building exit paths */ /* Update our understanding of whether the consensus has exits */ consensus_path_type_t old_have_consensus_path = have_consensus_path; - have_consensus_path = ((np > 0) ? + have_consensus_path = ((nu > 0) ? CONSENSUS_PATH_EXIT : CONSENSUS_PATH_INTERNAL);
@@ -1677,7 +1679,10 @@ update_router_have_minimum_dir_info(void) "can only build %d%% of likely paths. (We have %s.)", using_md?"micro":"", num_present, num_usable, (int)(paths*100), status); - log_warn(LD_NET, "%s%s", dir_info_status, suppression_msg); + if (!should_delay_dir_fetches(options, NULL) && + !directory_too_idle_to_fetch_descriptors(options, now)) { + log_warn(LD_NET, "%s%s", dir_info_status, suppression_msg); + } tor_free(suppression_msg); } tor_free(status);