[tor-commits] [tor/master] Stop trying to resolve our hostname so often

nickm at torproject.org nickm at torproject.org
Thu Feb 14 20:01:09 UTC 2013


commit 17089302fdb454e03f173cc0c70c5a69c5c1cd7b
Author: Roger Dingledine <arma at torproject.org>
Date:   Mon Feb 11 21:48:18 2013 -0500

    Stop trying to resolve our hostname so often
    
    For example, we were doing a resolve every time we think about doing a
    directory fetch. Now we reuse the cached answer in some cases.
    
    Fixes bugs 1992 (bugfix on 0.2.0.20-rc) and 2410 (bugfix on
    0.1.2.2-alpha).
---
 changes/bug1992 |    6 ++++++
 src/or/router.c |    4 ++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/changes/bug1992 b/changes/bug1992
new file mode 100644
index 0000000..6fa4eae
--- /dev/null
+++ b/changes/bug1992
@@ -0,0 +1,6 @@
+  o Minor bugfixes:
+    - Stop trying to resolve our hostname so often (e.g. every time we
+      think about doing a directory fetch). Now we reuse the cached
+      answer in some cases. Fixes bugs 1992 (bugfix on 0.2.0.20-rc)
+      and 2410 (bugfix on 0.1.2.2-alpha).
+
diff --git a/src/or/router.c b/src/or/router.c
index bc1c6d2..a668c24 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -1712,7 +1712,7 @@ 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, 0) < 0) {
+  if (resolve_my_address(LOG_INFO, options, addr, NULL, NULL, 1) < 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) {
@@ -2159,7 +2159,7 @@ router_new_address_suggestion(const char *suggestion,
   }
 
   /* XXXX ipv6 */
-  if (resolve_my_address(LOG_INFO, options, &cur, NULL, NULL, 0) >= 0) {
+  if (resolve_my_address(LOG_INFO, options, &cur, NULL, NULL, 1) >= 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 */





More information about the tor-commits mailing list