diff options
author | teor <teor2345@gmail.com> | 2014-10-01 18:54:26 +1000 |
---|---|---|
committer | teor <teor2345@gmail.com> | 2014-10-08 05:36:54 +1100 |
commit | ff42222845f5d79f27b653990cab4f20ad91a068 (patch) | |
tree | 06ad1fb8be7f17838ac1f6955ee0b3fca1e237b7 /src/or/entrynodes.c | |
parent | c1dd43d823c74f59f8ba0eff90f6ddab6763f408 (diff) | |
download | tor-ff42222845f5d79f27b653990cab4f20ad91a068.tar.gz tor-ff42222845f5d79f27b653990cab4f20ad91a068.zip |
Improve DIRINFO flags' usage comments
Document usage of the NO_DIRINFO and ALL_DIRINFO flags clearly in functions
which take them as arguments. Replace 0 with NO_DIRINFO in a function call
for clarity.
Seeks to prevent future issues like 13163.
Diffstat (limited to 'src/or/entrynodes.c')
-rw-r--r-- | src/or/entrynodes.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/or/entrynodes.c b/src/or/entrynodes.c index b1fd310f97..b160235289 100644 --- a/src/or/entrynodes.c +++ b/src/or/entrynodes.c @@ -1003,7 +1003,8 @@ node_understands_microdescriptors(const node_t *node) } /** Return true iff <b>node</b> is able to answer directory questions - * of type <b>dirinfo</b>. */ + * of type <b>dirinfo</b>. Always returns true if <b>dirinfo</b> is + * NO_DIRINFO (zero). */ static int node_can_handle_dirinfo(const node_t *node, dirinfo_type_t dirinfo) { @@ -1025,13 +1026,13 @@ node_can_handle_dirinfo(const node_t *node, dirinfo_type_t dirinfo) * <b>state</b> is non-NULL, this is for a specific circuit -- * make sure not to pick this circuit's exit or any node in the * exit's family. If <b>state</b> is NULL, we're looking for a random - * guard (likely a bridge). If <b>dirinfo</b> is not NO_DIRINFO, then - * only select from nodes that know how to answer directory questions + * guard (likely a bridge). If <b>dirinfo</b> is not NO_DIRINFO (zero), + * then only select from nodes that know how to answer directory questions * of that type. */ const node_t * choose_random_entry(cpath_build_state_t *state) { - return choose_random_entry_impl(state, 0, 0, NULL); + return choose_random_entry_impl(state, 0, NO_DIRINFO, NULL); } /** Pick a live (up and listed) directory guard from entry_guards for @@ -1139,7 +1140,9 @@ populate_live_entry_guards(smartlist_t *live_entry_guards, * If <b>for_directory</b> is set, we are looking for a directory guard. * * <b>dirinfo_type</b> contains the kind of directory information we - * are looking for in our node. + * are looking for in our node, or NO_DIRINFO (zero) if we are not + * looking for any particular directory information (when set to + * NO_DIRINFO, the <b>dirinfo_type</b> filter is ignored). * * If <b>n_options_out</b> is set, we set it to the number of * candidate guard nodes we had before picking a specific guard node. |