Combine router_get_advertised_or_port{,by_af_}() functions

This commit is contained in:
Nick Mathewson
2020-07-21 12:34:56 -04:00
parent 39146383fc
commit f478080bd0
5 changed files with 27 additions and 43 deletions
+4 -5
View File
@@ -3168,9 +3168,9 @@ retry_all_listeners(smartlist_t *new_conns, int close_all_noncontrol)
smartlist_t *replacements = smartlist_new();
const or_options_t *options = get_options();
int retval = 0;
const uint16_t old_or_port = router_get_advertised_or_port(options);
const uint16_t old_or_port = router_get_advertised_or_port(options, AF_INET);
const uint16_t old_or_port_ipv6 =
router_get_advertised_or_port_by_af(options,AF_INET6);
router_get_advertised_or_port(options,AF_INET6);
const uint16_t old_dir_port = router_get_advertised_dir_port(options, 0);
SMARTLIST_FOREACH_BEGIN(get_connection_array(), connection_t *, conn) {
@@ -3241,9 +3241,8 @@ retry_all_listeners(smartlist_t *new_conns, int close_all_noncontrol)
SMARTLIST_FOREACH(replacements, listener_replacement_t *, r, tor_free(r));
smartlist_free(replacements);
if (old_or_port != router_get_advertised_or_port(options) ||
old_or_port_ipv6 != router_get_advertised_or_port_by_af(options,
AF_INET6) ||
if (old_or_port != router_get_advertised_or_port(options, AF_INET) ||
old_or_port_ipv6 != router_get_advertised_or_port(options, AF_INET6) ||
old_dir_port != router_get_advertised_dir_port(options, 0)) {
/* Our chosen ORPort or DirPort is not what it used to be: the
* descriptor we had (if any) should be regenerated. (We won't