commit c32a8243cbb22ce3d89cf083d043ca2d7da14d4a Author: teor teor@torproject.org Date: Thu Apr 30 14:22:59 2020 +1000
nodelist: Wrap long lines, and improve comments
Part of 33222. --- src/feature/nodelist/node_select.c | 12 ++++++++---- src/feature/nodelist/routerlist.c | 21 ++++++++++++++++----- src/feature/nodelist/routerlist.h | 6 ++++-- 3 files changed, 28 insertions(+), 11 deletions(-)
diff --git a/src/feature/nodelist/node_select.c b/src/feature/nodelist/node_select.c index f1b54b663..da10856f5 100644 --- a/src/feature/nodelist/node_select.c +++ b/src/feature/nodelist/node_select.c @@ -321,8 +321,10 @@ router_pick_directory_server_impl(dirinfo_type_t type, int flags, overloaded_direct = smartlist_new(); overloaded_tunnel = smartlist_new();
- const int skip_or_fw = router_connect_assume_or_reachable(options, try_ip_pref); - const int skip_dir_fw = router_connect_assume_dir_reachable(options, try_ip_pref); + const int skip_or_fw = router_connect_assume_or_reachable(options, + try_ip_pref); + const int skip_dir_fw = router_connect_assume_dir_reachable(options, + try_ip_pref); const int must_have_or = dirclient_must_use_begindir(options);
/* Find all the running dirservers we know about. */ @@ -1120,8 +1122,10 @@ router_pick_trusteddirserver_impl(const smartlist_t *sourcelist, overloaded_direct = smartlist_new(); overloaded_tunnel = smartlist_new();
- const int skip_or_fw = router_connect_assume_or_reachable(options, try_ip_pref); - const int skip_dir_fw = router_connect_assume_dir_reachable(options, try_ip_pref); + const int skip_or_fw = router_connect_assume_or_reachable(options, + try_ip_pref); + const int skip_dir_fw = router_connect_assume_dir_reachable(options, + try_ip_pref); const int must_have_or = dirclient_must_use_begindir(options);
SMARTLIST_FOREACH_BEGIN(sourcelist, const dir_server_t *, d) diff --git a/src/feature/nodelist/routerlist.c b/src/feature/nodelist/routerlist.c index 1cc813f17..df94e1dce 100644 --- a/src/feature/nodelist/routerlist.c +++ b/src/feature/nodelist/routerlist.c @@ -465,11 +465,19 @@ router_reload_router_list(void) return 0; }
-/* When iterating through the routerlist, can OR address/port preference - * and reachability checks be skipped? +/* When selecting a router for a direct connection, can OR address/port + * preference and reachability checks be skipped? + * + * Servers never check ReachableAddresses or ClientPreferIPv6. Returns + * true for servers. + * + * Otherwise, if <b>try_ip_pref</b> is true, returns false. Used to make + * clients check ClientPreferIPv6, even if ReachableAddresses is not set. + * Finally, return true if ReachableAddresses is set. */ int -router_connect_assume_or_reachable(const or_options_t *options, int try_ip_pref) +router_connect_assume_or_reachable(const or_options_t *options, + int try_ip_pref) { /* Servers always have and prefer IPv4. * And if clients are checking against the firewall for reachability only, @@ -477,11 +485,14 @@ router_connect_assume_or_reachable(const or_options_t *options, int try_ip_pref) return server_mode(options) || (!try_ip_pref && !firewall_is_fascist_or()); }
-/* When iterating through the routerlist, can Dir address/port preference +/* When selecting a router for a direct connection, can Dir address/port * and reachability checks be skipped? + * + * This function is obsolete, because clients only use ORPorts. */ int -router_connect_assume_dir_reachable(const or_options_t *options, int try_ip_pref) +router_connect_assume_dir_reachable(const or_options_t *options, + int try_ip_pref) { /* Servers always have and prefer IPv4. * And if clients are checking against the firewall for reachability only, diff --git a/src/feature/nodelist/routerlist.h b/src/feature/nodelist/routerlist.h index 56109374f..78d8bfc64 100644 --- a/src/feature/nodelist/routerlist.h +++ b/src/feature/nodelist/routerlist.h @@ -50,8 +50,10 @@ typedef enum was_router_added_t {
int router_reload_router_list(void);
-int router_connect_assume_or_reachable(const or_options_t *options, int try_ip_pref); -int router_connect_assume_dir_reachable(const or_options_t *options, int try_ip_pref); +int router_connect_assume_or_reachable(const or_options_t *options, + int try_ip_pref); +int router_connect_assume_dir_reachable(const or_options_t *options, + int try_ip_pref); void router_reset_status_download_failures(void); int routers_have_same_or_addrs(const routerinfo_t *r1, const routerinfo_t *r2); void router_add_running_nodes_to_smartlist(smartlist_t *sl, int need_uptime,
tor-commits@lists.torproject.org