]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Only Tors that want to mirror the v2 directory info should
authorRoger Dingledine <arma@torproject.org>
Thu, 20 Dec 2007 06:47:59 +0000 (06:47 +0000)
committerRoger Dingledine <arma@torproject.org>
Thu, 20 Dec 2007 06:47:59 +0000 (06:47 +0000)
create the "cached-status" directory in their datadir. All Tors
used to create it. Bugfix on 0.1.2.x.

Bridge relays with DirPort set to 0 no longer cache v1 or v2
directory information; there's no point. Bugfix on trunk.

svn:r12887

ChangeLog
src/or/config.c
src/or/dirserv.c
src/or/networkstatus.c
src/or/or.h
src/or/routerparse.c

index e834d5720c4b51fa04cb9c2413f87355854fdea1..59a4555007d5ec9c28e5498ac762247b592554a4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -90,6 +90,9 @@ Changes in version 0.2.0.13-alpha - 2007-12-??
     - When we decide to send a 503 response to a request for servers, do
       not then also send the server descriptors: this defeats the whole
       purpose.  Fixes bug 539; bugfix on 0.1.2.x.
+    - Only Tors that want to mirror the v2 directory info should
+      create the "cached-status" directory in their datadir. All Tors
+      used to create it. Bugfix on 0.1.2.x.
 
   o Minor features:
     - On USR1, when dmalloc is in use, log the top 10 memory
index 83fec4e1bb4fc25ff4b01770df702201689c8a1e..437a75690e732e023f79ef11df67491dd19aa583 100644 (file)
@@ -1108,7 +1108,7 @@ options_act(or_options_t *old_options)
     return -1;
   }
 
-  if (running_tor) {
+  if (running_tor && directory_caches_v2_dir_info(options)) {
     len = strlen(options->DataDirectory)+32;
     fn = tor_malloc(len);
     tor_snprintf(fn, len, "%s"PATH_SEPARATOR"cached-status",
index e45a6ea8f795ee5658d2669c7bcee2a3b2b5bcac..364337514ec9c924a151c64e29b496673ca6f5c4 100644 (file)
@@ -1147,6 +1147,14 @@ directory_fetches_dir_info_like_bridge_user(or_options_t *options)
   return options->UseBridges != 0;
 }
 
+/** Return 1 if we want to cache v2 dir info (each status file).
+ */
+int
+directory_caches_v2_dir_info(or_options_t *options)
+{
+  return options->DirPort != 0;
+}
+
 /** Return 1 if we want to keep descriptors, networkstatuses, etc around
  * and we're willing to serve them to others. Else return 0.
  */
index 28d0010ff75e90647adf40a18738cb7708332ac9..54b92a8fa3a366ea76b85cf744c972b21fd73605 100644 (file)
@@ -495,7 +495,7 @@ add_networkstatus_to_cache(const char *s,
     tor_free(fn);
   }
 
-  if (directory_caches_dir_info(get_options()))
+  if (directory_caches_v2_dir_info(get_options()))
     dirserv_set_cached_networkstatus_v2(s,
                                         ns->identity_digest,
                                         ns->published_on);
@@ -540,7 +540,7 @@ router_set_networkstatus_v2(const char *s, time_t arrived_at,
   char fp[HEX_DIGEST_LEN+1];
   char published[ISO_TIME_LEN+1];
 
-  if (!directory_caches_dir_info(get_options()))
+  if (!directory_caches_v2_dir_info(get_options()))
     return 0; /* Don't bother storing it. */
 
   ns = networkstatus_v2_parse_from_string(s);
@@ -721,7 +721,7 @@ networkstatus_v2_list_clean(time_t now)
       unlink(fname);
     }
     tor_free(fname);
-    if (directory_caches_dir_info(get_options())) {
+    if (directory_caches_v2_dir_info(get_options())) {
       dirserv_set_cached_networkstatus_v2(NULL, ns->identity_digest, 0);
     }
     networkstatus_v2_free(ns);
index 35e66fe798a6e15d67526c41ecb5a89d6afe45b9..f20211d95e8703593b1e68b4135295ac5a5408d1 100644 (file)
@@ -3068,6 +3068,8 @@ int dirserv_dump_directory_to_string(char **dir_out,
 int directory_fetches_from_authorities(or_options_t *options);
 int directory_fetches_dir_info_like_mirror(or_options_t *options);
 int directory_fetches_dir_info_like_bridge_user(or_options_t *options);
+int directory_caches_v2_dir_info(or_options_t *options);
+#define directory_caches_v1_dir_info(o) directory_caches_v2_dir_info(o)
 int directory_caches_dir_info(or_options_t *options);
 int directory_permits_begindir_requests(or_options_t *options);
 int directory_permits_controller_requests(or_options_t *options);
index afdd9dc15846d5fcb6ee2ef8d87d6357591a55bb..e6d60c9c7811b971e7e2a059f87dfc1367e15c6c 100644 (file)
@@ -687,7 +687,7 @@ router_parse_directory(const char *str)
 
   /* Now that we know the signature is okay, and we have a
    * publication time, cache the directory. */
-  if (directory_caches_dir_info(get_options()) &&
+  if (directory_caches_v1_dir_info(get_options()) &&
       !authdir_mode_v1(get_options()))
     dirserv_set_cached_directory(str, published_on, 0);