aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2014-04-08 15:49:49 -0400
committerNick Mathewson <nickm@torproject.org>2014-04-08 15:51:40 -0400
commit6ab10a546663b509d189ce16645b11af0e83d41c (patch)
tree1a5f5c889e948bfbbb87d3c4a9791b436b9c1440 /src
parent7aa21920481fc4f0bdb159aeedf11582aa95dd01 (diff)
downloadtor-6ab10a546663b509d189ce16645b11af0e83d41c.tar
tor-6ab10a546663b509d189ce16645b11af0e83d41c.tar.gz
Make num_bridges_usable work properly.
My first implementation was broken, since it returned "whether there is one bridge" rather than "how many bridges." Also, the implementation for the n_options_out feature in choose_random_entry_impl was completely broken due to a missing *.
Diffstat (limited to 'src')
-rw-r--r--src/or/entrynodes.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/or/entrynodes.c b/src/or/entrynodes.c
index a08fda424..da3521ecd 100644
--- a/src/or/entrynodes.c
+++ b/src/or/entrynodes.c
@@ -1013,7 +1013,7 @@ choose_random_entry_impl(cpath_build_state_t *state, int for_directory,
const int num_needed = decide_num_guards(options, for_directory);
if (n_options_out)
- n_options_out = 0;
+ *n_options_out = 0;
if (chosen_exit) {
nodelist_add_node_and_family(exit_family, chosen_exit);
@@ -2215,8 +2215,8 @@ any_bridge_descriptors_known(void)
return choose_random_entry(NULL) != NULL;
}
-/** Return the number of bridges that have descriptors that
- * are marked with purpose 'bridge' and are running.
+/** Return the number of bridges that have descriptors that are marked with
+ * purpose 'bridge' and are running.
*/
static int
num_bridges_usable(void)
@@ -2224,7 +2224,7 @@ num_bridges_usable(void)
int n_options = 0;
tor_assert(get_options()->UseBridges);
(void) choose_random_entry_impl(NULL, 0, 0, &n_options);
- return n_options == 1;
+ return n_options;
}
/** Return 1 if there are any directory conns fetching bridge descriptors