nodelist: Wrap long lines, and improve comments

Part of 33222.
This commit is contained in:
teor 2020-04-30 14:22:59 +10:00
parent caab67d0c2
commit c32a8243cb
3 changed files with 28 additions and 11 deletions

View File

@ -321,8 +321,10 @@ router_pick_directory_server_impl(dirinfo_type_t type, int flags,
overloaded_direct = smartlist_new(); overloaded_direct = smartlist_new();
overloaded_tunnel = smartlist_new(); overloaded_tunnel = smartlist_new();
const int skip_or_fw = router_connect_assume_or_reachable(options, try_ip_pref); const int skip_or_fw = router_connect_assume_or_reachable(options,
const int skip_dir_fw = router_connect_assume_dir_reachable(options, try_ip_pref); 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); const int must_have_or = dirclient_must_use_begindir(options);
/* Find all the running dirservers we know about. */ /* 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_direct = smartlist_new();
overloaded_tunnel = smartlist_new(); overloaded_tunnel = smartlist_new();
const int skip_or_fw = router_connect_assume_or_reachable(options, try_ip_pref); const int skip_or_fw = router_connect_assume_or_reachable(options,
const int skip_dir_fw = router_connect_assume_dir_reachable(options, try_ip_pref); 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); const int must_have_or = dirclient_must_use_begindir(options);
SMARTLIST_FOREACH_BEGIN(sourcelist, const dir_server_t *, d) SMARTLIST_FOREACH_BEGIN(sourcelist, const dir_server_t *, d)

View File

@ -465,11 +465,19 @@ router_reload_router_list(void)
return 0; return 0;
} }
/* When iterating through the routerlist, can OR address/port preference /* When selecting a router for a direct connection, can OR address/port
* and reachability checks be skipped? * 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 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. /* Servers always have and prefer IPv4.
* And if clients are checking against the firewall for reachability only, * 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()); 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? * and reachability checks be skipped?
*
* This function is obsolete, because clients only use ORPorts.
*/ */
int 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. /* Servers always have and prefer IPv4.
* And if clients are checking against the firewall for reachability only, * And if clients are checking against the firewall for reachability only,

View File

@ -50,8 +50,10 @@ typedef enum was_router_added_t {
int router_reload_router_list(void); 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_or_reachable(const or_options_t *options,
int router_connect_assume_dir_reachable(const or_options_t *options, int try_ip_pref); 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); void router_reset_status_download_failures(void);
int routers_have_same_or_addrs(const routerinfo_t *r1, const routerinfo_t *r2); 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, void router_add_running_nodes_to_smartlist(smartlist_t *sl, int need_uptime,