- 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
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",
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.
*/
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);
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);
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);
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);
/* 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);