diff --git a/src/or/main.c b/src/or/main.c index dd16822777..801b80da83 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -682,6 +682,7 @@ run_scheduled_events(time_t now) if (time_to_fetch_directory < now) { /* purge obsolete entries */ routerlist_remove_old_routers(ROUTER_MAX_AGE); + networkstatus_list_clean(now); if (authdir_mode(options)) { if (!we_are_hibernating()) { /* try to determine reachability */ diff --git a/src/or/or.h b/src/or/or.h index a25be01b60..a554057678 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -2089,6 +2089,7 @@ void routerlist_free_all(void); routerinfo_t *routerinfo_copy(const routerinfo_t *router); void router_mark_as_down(const char *digest); void routerlist_remove_old_routers(int age); +void networkstatus_list_clean(time_t now); int router_add_to_routerlist(routerinfo_t *router, const char **msg, int from_cache); int router_load_single_router(const char *s, const char **msg); diff --git a/src/or/routerlist.c b/src/or/routerlist.c index 4759da2950..6b4295d4c1 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -88,6 +88,7 @@ router_reload_networkstatus(void) tor_free(s); } }); + networkstatus_list_clean(time(NULL)); routers_update_all_from_networkstatus(); return 0; } @@ -122,7 +123,7 @@ router_should_rebuild_store(void) /** Add the len-type router descriptor in s to the router * journal. */ -int +static int router_append_to_journal(const char *s, size_t len) { or_options_t *options = get_options(); @@ -150,7 +151,7 @@ router_append_to_journal(const char *s, size_t len) * replace the router store with the routers currently in our routerlist, and * clear the journal. Return 0 on success, -1 on failure. */ -int +static int router_rebuild_store(int force) { size_t len = 0; @@ -1595,7 +1596,7 @@ _compare_digest_to_routerstatus_entry(const void *_key, const void **_member) /** Return the entry in ns for the identity digest digest, or * NULL if none was found. */ -routerstatus_t * +static routerstatus_t * networkstatus_find_entry(networkstatus_t *ns, const char *digest) { return smartlist_bsearch(ns->entries, digest, @@ -2339,7 +2340,7 @@ routers_update_status_from_networkstatus(smartlist_t *routers) * published more recently, or it it is listed in the network-status but not * in the router list. */ -smartlist_t * +static smartlist_t * router_list_downloadable(void) { smartlist_t *superseded = smartlist_create();