make some functions static; clean dead networkstatus entries more often.

svn:r5072
This commit is contained in:
Nick Mathewson 2005-09-15 05:41:30 +00:00
parent 3dcc4630b9
commit b70c229f6e
3 changed files with 7 additions and 4 deletions

View File

@ -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 */

View File

@ -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);

View File

@ -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 <b>len</b>-type router descriptor in <b>s</b> 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 <b>ns</b> for the identity digest <b>digest</b>, 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();