[or-cvs] r14418: Periodically launch requests for server/authority.z when it (in tor/trunk: . src/or)

nickm at seul.org nickm at seul.org
Tue Apr 22 21:10:41 UTC 2008


Author: nickm
Date: 2008-04-22 17:10:41 -0400 (Tue, 22 Apr 2008)
New Revision: 14418

Modified:
   tor/trunk/
   tor/trunk/ChangeLog
   tor/trunk/src/or/routerlist.c
Log:
 r15287 at tombo:  nickm | 2008-04-22 17:09:25 -0400
 Periodically launch requests for server/authority.z when it might help us learn our IP.  Fix for bug 652.



Property changes on: tor/trunk
___________________________________________________________________
 svk:merge ticket from /tor/trunk [r15287] on 49666b30-7950-49c5-bedf-9dc8f3168102

Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog	2008-04-22 18:38:25 UTC (rev 14417)
+++ tor/trunk/ChangeLog	2008-04-22 21:10:41 UTC (rev 14418)
@@ -40,6 +40,8 @@
     - When we choose to abandon a new entry guard because we think our
       older ones might be better, close any circuits pending on that
       new entry guard connection. Bugfix on 0.1.2.8-beta; found by lodger.
+    - Detect address changes correctly on non-directory mirror
+      servers.  Fix for bug 652.
 
   o Minor features:
     - Allow separate log levels to be configured for different logging

Modified: tor/trunk/src/or/routerlist.c
===================================================================
--- tor/trunk/src/or/routerlist.c	2008-04-22 18:38:25 UTC (rev 14417)
+++ tor/trunk/src/or/routerlist.c	2008-04-22 21:10:41 UTC (rev 14418)
@@ -4013,17 +4013,37 @@
   smartlist_free(no_longer_old);
 }
 
+/** How often should we launch a server/authority request to be sure of getting
+ * a guess for our IP? */
+/*XXXX021 this info should come from netinfo cells or something, or we should
+ * do this only when we aren't seeing incoming data. see bug 652. */
+#define DUMMY_DOWNLOAD_INTERVAL (20*60)
+
 /** Launch downloads for router status as needed. */
 void
 update_router_descriptor_downloads(time_t now)
 {
   or_options_t *options = get_options();
+  static time_t last_dummy_download = 0;
   if (should_delay_dir_fetches(options))
     return;
   if (directory_fetches_dir_info_early(options)) {
     update_router_descriptor_cache_downloads_v2(now);
   }
   update_consensus_router_descriptor_downloads(now);
+
+  /* XXXX021 we could be smarter here; see notes on bug 652. */
+  /* If we're a server that doesn't have a configured address, we rely on
+   * directory fetches to learn when our address changes.  So if we haven't
+   * tried to get any routerdescs in a long time, try a dummy fetch now. */
+  if (!options->Address &&
+      server_mode(options) &&
+      last_routerdesc_download_attempted + DUMMY_DOWNLOAD_INTERVAL < now &&
+      last_dummy_download + DUMMY_DOWNLOAD_INTERVAL < now) {
+    last_dummy_download = now;
+    directory_get_from_dirserver(DIR_PURPOSE_FETCH_SERVERDESC,
+                                 ROUTER_PURPOSE_GENERAL, "authority.z", 1);
+  }
 }
 
 /** Launch extrainfo downloads as needed. */



More information about the tor-commits mailing list