reset warning flags on SIGHUP. arma: is this everything?

svn:r5192
This commit is contained in:
Nick Mathewson
2005-10-05 02:20:46 +00:00
parent be478bb56c
commit 509de69a7e
3 changed files with 32 additions and 5 deletions
+1
View File
@@ -929,6 +929,7 @@ do_hup(void)
if (accounting_is_enabled(options))
accounting_record_bandwidth_usage(time(NULL));
routerlist_reset_warnings();
addressmap_clear_transient();
/* first, reload config variables, in case they've changed */
/* no need to provide argc/v, they've been cached inside init_from_config */
+1
View File
@@ -2114,6 +2114,7 @@ routerinfo_t *router_get_by_hexdigest(const char *hexdigest);
routerinfo_t *router_get_by_digest(const char *digest);
int router_digest_is_trusted_dir(const char *digest);
void router_get_routerlist(routerlist_t **prouterlist);
void routerlist_reset_warnings(void);
void routerlist_free(routerlist_t *routerlist);
void routerinfo_free(routerinfo_t *router);
void routerstatus_free(routerstatus_t *routerstatus);
+30 -5
View File
@@ -48,7 +48,7 @@ extern int has_fetched_directory; /**< from main.c */
/** Global list of all of the current network_status documents that we know
* about. This list is kept sorted by published_on. */
static smartlist_t *networkstatus_list = NULL;
/** Global list of routerstatuses_t for each router, known or unknown. */
/** Global list of local_routerstatus_t for each router, known or unknown. */
static smartlist_t *routerstatus_list = NULL;
/** True iff any member of networkstatus_list has changed since the last time
* we called routerstatus_list_update_from_networkstatus(). */
@@ -63,6 +63,11 @@ static smartlist_t *warned_nicknames = NULL;
* and that are still conflicted. */
static smartlist_t *warned_conflicts = NULL;
/*DOCDOC*/
static int have_warned_about_unverified_status = 0;
static int have_warned_about_old_version = 0;
static int have_warned_about_new_version = 0;
/** Repopulate our list of network_status_t objects from the list cached on
* disk. Return 0 on success, -1 on failure. */
int
@@ -1069,7 +1074,7 @@ routerlist_free_all(void)
if (warned_conflicts) {
SMARTLIST_FOREACH(warned_conflicts, char *, cp, tor_free(cp));
smartlist_free(warned_conflicts);
warned_nicknames = NULL;
warned_conflicts = NULL;
}
if (trusted_dir_servers) {
SMARTLIST_FOREACH(trusted_dir_servers, trusted_dir_server_t *, ds,
@@ -1122,6 +1127,29 @@ networkstatus_free(networkstatus_t *ns)
tor_free(ns);
}
/** Forget that we have issued any router-related warnings, so that we'll
* warn again if we see the same errors. */
void
routerlist_reset_warnings(void)
{
if (!warned_nicknames)
warned_nicknames = smartlist_create();
SMARTLIST_FOREACH(warned_nicknames, char *, cp, tor_free(cp));
smartlist_clear(warned_nicknames); /* now the list is empty. */
if (!warned_conflicts)
warned_conflicts = smartlist_create();
SMARTLIST_FOREACH(warned_conflicts, char *, cp, tor_free(cp));
smartlist_clear(warned_conflicts); /* now the list is empty. */
SMARTLIST_FOREACH(routerstatus_list, local_routerstatus_t *, rs,
rs->name_lookup_warned = 0);
have_warned_about_unverified_status = 0;
have_warned_about_old_version = 0;
have_warned_about_new_version = 0;
}
/** Mark the router with ID <b>digest</b> as non-running in our routerlist. */
void
router_mark_as_down(const char *digest)
@@ -2078,9 +2106,6 @@ void
routers_update_all_from_networkstatus(void)
{
#define SELF_OPINION_INTERVAL 90*60
static int have_warned_about_unverified_status = 0;
static int have_warned_about_old_version = 0;
static int have_warned_about_new_version = 0;
routerinfo_t *me;
time_t now;
if (!routerlist || !networkstatus_list ||