r17558@catbus: nickm | 2008-01-10 13:07:41 -0500

If we do not serve v2 directory info, and our cached v2 networkstatus files are very old, remove them.  If the directory is old, remove that too.  (We already did this for obsolete routers files.)


svn:r13096
This commit is contained in:
Nick Mathewson 2008-01-10 18:08:42 +00:00
parent 2ac1e36248
commit 10d86f7615
3 changed files with 23 additions and 6 deletions

View File

@ -18,6 +18,9 @@ Changes in version 0.2.0.16-alpha - 2008-01-??
responses _and_ send a body too), there are still servers out there
that haven't upgraded. Therefore, make clients parse such bodies
when they receive them.
- When we're not serving v2 directory information, there is no reason
to actually keep any around. Remove the obsolete files and directory
on startup if they are very old and we aren't going to serve them.
o Minor performance improvements:
- Reference-count and share copies of address policy entries; only

View File

@ -25,7 +25,7 @@ R - let bridges set relaybandwidthrate as low as 5kb
RK- make it easier to set up a private tor network on your own computer
is very hard.
- FAQ entry which is wrong
- Make BEGIN_DIR mandatory for asking questions of bridge authorities?
o Make BEGIN_DIR mandatory for asking questions of bridge authorities?
(but only for bridge descriptors. not for ordinary cache stuff.)
o Implement connection_dir_is_encrypted().
o set up a filter to not answer any bridge descriptors on a
@ -50,9 +50,9 @@ R - bridge communities
- be able to have bridges that aren't in your torrc
Things we'd like to do in 0.2.0.x:
N - if we notice a cached-status directory and we're not serving v2 dir
info and it's old enough, delete it. same with cached-routers*.
Nick says: don't we already do that?
o if we notice a cached-status directory and we're not serving v2 dir
info and it's old enough, delete it.
o same with cached-routers*.
N - document the "3/4 and 7/8" business in the clients fetching consensus
documents timeline.
R - then document the bridge user download timeline.

View File

@ -122,15 +122,29 @@ router_reload_v2_networkstatus(void)
struct stat st;
char *s;
char *filename = get_datadir_fname("cached-status");
int maybe_delete = !directory_caches_v2_dir_info(get_options());
time_t now = time(NULL);
if (!networkstatus_v2_list)
networkstatus_v2_list = smartlist_create();
entries = tor_listdir(filename);
if (!entries) { /* dir doesn't exist */
tor_free(filename);
if (!entries) /* dir doesn't exist */
return 0;
} else if (!smartlist_len(entries) && maybe_delete) {
rmdir(filename);
tor_free(filename);
return 0;
}
tor_free(filename);
SMARTLIST_FOREACH(entries, const char *, fn, {
char buf[DIGEST_LEN];
if (maybe_delete) {
filename = get_datadir_fname2("cached-status", fn);
remove_file_if_very_old(filename, now);
tor_free(filename);
continue;
}
if (strlen(fn) != HEX_DIGEST_LEN ||
base16_decode(buf, sizeof(buf), fn, strlen(fn))) {
log_info(LD_DIR,