diff --git a/ChangeLog b/ChangeLog index c1d8dc39d..a39c1ad15 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,9 @@ Changes in version 0.1.2.8-alpha - 2007-??-?? o Major bugfixes (crashes): - Stop crashing when the controller asks us to resetconf more than one config option at once. (Vidalia 0.0.11 does this.) + - Fix a crash that happened on Win98 when we're given command-line + arguments: Don't try to load NT service functions from advapi32.dll + except when we need them. (bug introduced in 0.1.2.7-alpha). o Minor bugfixes (controller): - Give the controller END_STREAM_REASON_DESTROY events _before_ we @@ -31,8 +34,6 @@ Changes in version 0.1.2.8-alpha - 2007-??-?? other than file-not-found. - Don't warn the user when cached-routers.new doesn't exist: that's perfectly fine when starting up for the first time. - - Don't try to load NT service functions from advapi32.dll except when - we need them. (bug introduced in 0.1.2.7-alpha). o Minor features: - Warn the user when an application uses the obsolete binary v0 @@ -49,6 +50,8 @@ Changes in version 0.1.2.8-alpha - 2007-??-?? protocol easier to recognize on the wire.) - Revise messages on handshake failure again to be even more clear about which are incoming connections and which are outgoing. + - Discard any v1 directory info that's over 1 month old (for + directories) or over 1 week old (for running-routers lists). Changes in version 0.1.2.7-alpha - 2007-02-06 diff --git a/src/or/dirserv.c b/src/or/dirserv.c index b317a4baa..e7ac7bccc 100644 --- a/src/or/dirserv.c +++ b/src/or/dirserv.c @@ -937,10 +937,11 @@ dirserv_dump_directory_to_string(char **dir_out, return -1; } -/** Most recently generated encoded signed directory. (auth dirservers only.)*/ +/** Most recently generated encoded signed v1 directory. (auth dirservers + * only.)*/ static cached_dir_t *the_directory = NULL; -/* Used only by non-auth dirservers: The directory and runningrouters we'll +/* Used only by non-auth dirservers: The v1 directory and runningrouters we'll * serve when requested. */ static cached_dir_t *cached_directory = NULL; static cached_dir_t cached_runningrouters = { NULL, NULL, 0, 0, 0, -1 }; @@ -1135,7 +1136,22 @@ dirserv_clear_old_networkstatuses(time_t cutoff) iter = digestmap_iter_next(cached_v2_networkstatus, iter); } } +} +/** Remove any networkstatus from the directory cache that was published + * before cutoff. */ +void +dirserv_clear_old_v1_info(time_t now) +{ +#define MAX_V1_DIRECTORY_AGE (30*24*60*60) +#define MAX_V1_RR_AGE (7*24*60*60) + if (cached_directory && + cached_directory->published < (now-MAX_V1_DIRECTORY_AGE)) { + cached_dir_decref(cached_directory); + } + if (cached_runningrouters.published < (now - MAX_V1_RR_AGE)) { + clear_cached_dir(&cached_runningrouters); + } } /** Helper: If we're an authority for the right directory version (the diff --git a/src/or/or.h b/src/or/or.h index 519244b9e..b68ac432b 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -2427,6 +2427,7 @@ void dirserv_set_cached_networkstatus_v2(const char *directory, const char *identity, time_t published); void dirserv_clear_old_networkstatuses(time_t cutoff); +void dirserv_clear_old_v1_info(time_t now); void dirserv_get_networkstatus_v2(smartlist_t *result, const char *key); void dirserv_get_networkstatus_v2_fingerprints(smartlist_t *result, const char *key); diff --git a/src/or/routerlist.c b/src/or/routerlist.c index 84c546020..023a9c226 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -2590,8 +2590,9 @@ networkstatus_list_clean(time_t now) } /* And now go through the directory cache for any cached untrusted - * networkstatuses. */ + * networkstatuses and other network info. */ dirserv_clear_old_networkstatuses(now - MAX_NETWORKSTATUS_AGE); + dirserv_clear_old_v1_info(now); } /** Helper for bsearching a list of routerstatus_t pointers.*/