[or-cvs] Tweak on patch to make authoritative directory servers cache
Nick Mathewson
nickm at seul.org
Mon Nov 15 16:18:02 UTC 2004
Update of /home/or/cvsroot/tor/src/or
In directory moria.mit.edu:/tmp/cvs-serv15910/src/or
Modified Files:
dirserv.c routerparse.c
Log Message:
Tweak on patch to make authoritative directory servers cache
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.
Index: dirserv.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/dirserv.c,v
retrieving revision 1.120
retrieving revision 1.121
diff -u -d -r1.120 -r1.121
--- dirserv.c 15 Nov 2004 09:38:17 -0000 1.120
+++ dirserv.c 15 Nov 2004 16:17:59 -0000 1.121
@@ -807,6 +807,10 @@
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 @@
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: routerparse.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/routerparse.c,v
retrieving revision 1.80
retrieving revision 1.81
diff -u -d -r1.80 -r1.81
--- routerparse.c 15 Nov 2004 09:38:17 -0000 1.80
+++ routerparse.c 15 Nov 2004 16:17:59 -0000 1.81
@@ -389,7 +389,8 @@
/* 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 @@
/* 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))) {
More information about the tor-commits
mailing list