diff options
author | Roger Dingledine <arma@torproject.org> | 2013-02-12 04:25:42 -0500 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2013-02-12 04:25:42 -0500 |
commit | 178599f026d9c7575a2b790c7cb5ccfba7ba1635 (patch) | |
tree | dcc399d37ee5bc73a11ab11daceb36a97007f398 /src/or/router.c | |
parent | b166e9edb96288e8f94776b738c1dc0874a9cffa (diff) | |
download | tor-178599f026d9c7575a2b790c7cb5ccfba7ba1635.tar.gz tor-178599f026d9c7575a2b790c7cb5ccfba7ba1635.zip |
get rid of the new caching notion in resolve_my_address()
and replace it with the good old-fashioned two functions approach
Diffstat (limited to 'src/or/router.c')
-rw-r--r-- | src/or/router.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/or/router.c b/src/or/router.c index a668c24bed..7b1fdc0dfe 100644 --- a/src/or/router.c +++ b/src/or/router.c @@ -1712,7 +1712,9 @@ static int router_guess_address_from_dir_headers(uint32_t *guess); int router_pick_published_address(const or_options_t *options, uint32_t *addr) { - if (resolve_my_address(LOG_INFO, options, addr, NULL, NULL, 1) < 0) { + *addr = get_last_resolved_addr(); + if (!*addr && + resolve_my_address(LOG_INFO, options, addr, NULL, NULL) < 0) { log_info(LD_CONFIG, "Could not determine our address locally. " "Checking if directory headers provide any hints."); if (router_guess_address_from_dir_headers(addr) < 0) { @@ -2103,7 +2105,7 @@ check_descriptor_ipaddress_changed(time_t now) /* XXXX ipv6 */ prev = desc_routerinfo->addr; - if (resolve_my_address(LOG_INFO, options, &cur, &method, &hostname, 0) < 0) { + if (resolve_my_address(LOG_INFO, options, &cur, &method, &hostname) < 0) { log_info(LD_CONFIG,"options->Address didn't resolve into an IP."); return; } @@ -2159,7 +2161,9 @@ router_new_address_suggestion(const char *suggestion, } /* XXXX ipv6 */ - if (resolve_my_address(LOG_INFO, options, &cur, NULL, NULL, 1) >= 0) { + cur = get_last_resolved_addr(); + if (cur || + resolve_my_address(LOG_INFO, options, &cur, NULL, NULL) >= 0) { /* We're all set -- we already know our address. Great. */ tor_addr_from_ipv4h(&last_guessed_ip, cur); /* store it in case we need it later */ |