]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Tweak on patch to make authoritative directory servers cache
authorNick Mathewson <nickm@torproject.org>
Mon, 15 Nov 2004 16:17:59 +0000 (16:17 +0000)
committerNick Mathewson <nickm@torproject.org>
Mon, 15 Nov 2004 16:17:59 +0000 (16:17 +0000)
directories on disk.  Make authdirservers cache *their own*
directories instead of the ones they download.  This gives better
liveness, and marginally better resistance to broken authdirservers.

Authdirservers don't cache running-routers at all: r-r isn't stored to
disk, so there's no point right now.

svn:r2893

src/or/dirserv.c
src/or/routerparse.c

index f2946f9082e21fadf5e19106d0a98adfa7ed9c37..e96adc0a7133a7c2149f8dcfd169908b3709ad2e 100644 (file)
@@ -807,6 +807,10 @@ static int dirserv_regenerate_directory(void)
   tor_free(new_directory);
   the_directory_is_dirty = 0;
 
+  /* Save the directory to disk so we re-load it quickly on startup.
+   */
+  dirserv_set_cached_directory(the_directory, time(NULL), 0);
+
   return 0;
 }
 
@@ -891,6 +895,11 @@ static int generate_runningrouters(crypto_pk_env_t *private_key)
     return -1;
   }
   runningrouters_is_dirty = 0;
+
+  /* We don't cache runnning-routers to disk, so there's no point in
+   * authdirservers caching it. */
+  /* dirserv_set_cached_directory(the_runningrouters, time(NULL), 1); */
+
   return 0;
  err:
   tor_free(s);
index 5c2cd28f8298165f39811278114ce6a7aac4dfb8..ca7d6ed5d3c8e500ffdc7a4c77a1452125c3bcdb 100644 (file)
@@ -389,7 +389,8 @@ router_parse_routerlist_from_directory(const char *str,
 
   /* Now that we know the signature is okay, and we have a
    * publication time, cache the directory. */
-  dirserv_set_cached_directory(str, published_on, 0);
+  if (!get_options()->AuthoritativeDir)
+    dirserv_set_cached_directory(str, published_on, 0);
 
   if (!(tok = find_first_by_keyword(tokens, K_RECOMMENDED_SOFTWARE))) {
     log_fn(LOG_WARN, "Missing recommended-software line from directory.");
@@ -515,7 +516,8 @@ router_parse_runningrouters(const char *str)
 
   /* Now that we know the signature is okay, and we have a
    * publication time, cache the list. */
-  dirserv_set_cached_directory(str, published_on, 1);
+  if (!get_options()->AuthoritativeDir)
+    dirserv_set_cached_directory(str, published_on, 1);
 
   if (!(tok = find_first_by_keyword(tokens, K_ROUTER_STATUS))) {
     if (!(tok = find_first_by_keyword(tokens, K_RUNNING_ROUTERS))) {