aboutsummaryrefslogtreecommitdiff
path: root/src/or/config.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2013-02-12 04:25:42 -0500
committerRoger Dingledine <arma@torproject.org>2013-02-12 04:25:42 -0500
commit178599f026d9c7575a2b790c7cb5ccfba7ba1635 (patch)
treedcc399d37ee5bc73a11ab11daceb36a97007f398 /src/or/config.c
parentb166e9edb96288e8f94776b738c1dc0874a9cffa (diff)
downloadtor-178599f026d9c7575a2b790c7cb5ccfba7ba1635.tar
tor-178599f026d9c7575a2b790c7cb5ccfba7ba1635.tar.gz
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/config.c')
-rw-r--r--src/or/config.c27
1 files changed, 9 insertions, 18 deletions
diff --git a/src/or/config.c b/src/or/config.c
index e37b148b7..a11c44bdf 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -1893,6 +1893,13 @@ list_torrc_options(void)
/** Last value actually set by resolve_my_address. */
static uint32_t last_resolved_addr = 0;
+
+/** Accessor for last_resolved_addr from outside this file. */
+uint32_t get_last_resolved_addr(void)
+{
+ return last_resolved_addr;
+}
+
/**
* Use <b>options-\>Address</b> to guess our public IP address.
*
@@ -1908,16 +1915,12 @@ static uint32_t last_resolved_addr = 0;
* holding that hostname. (If we didn't get our address by resolving a
* hostname, set *<b>hostname_out</b> to NULL.)
*
- * If <b>use_cached_addr</b> is true, and we have a plausible answer,
- * provide that answer and return.
- *
* XXXX ipv6
*/
int
resolve_my_address(int warn_severity, const or_options_t *options,
uint32_t *addr_out,
- const char **method_out, char **hostname_out,
- int use_cached_addr)
+ const char **method_out, char **hostname_out)
{
struct in_addr in;
uint32_t addr; /* host order */
@@ -1935,18 +1938,6 @@ resolve_my_address(int warn_severity, const or_options_t *options,
tor_assert(addr_out);
/*
- * Step zero: if used_cached_addr is true, and we have a cached answer,
- * just return it and be done.
- */
-
- if (use_cached_addr && last_resolved_addr) {
- *addr_out = last_resolved_addr;
- if (method_out)
- *method_out = "CACHED";
- return 0;
- }
-
- /*
* Step one: Fill in 'hostname' to be our best guess.
*/
@@ -2359,7 +2350,7 @@ options_validate(or_options_t *old_options, or_options_t *options,
if (authdir_mode(options)) {
/* confirm that our address isn't broken, so we can complain now */
uint32_t tmp;
- if (resolve_my_address(LOG_WARN, options, &tmp, NULL, NULL, 0) < 0)
+ if (resolve_my_address(LOG_WARN, options, &tmp, NULL, NULL) < 0)
REJECT("Failed to resolve/guess local address. See logs for details.");
}