summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2005-10-05 02:20:46 +0000
committerNick Mathewson <nickm@torproject.org>2005-10-05 02:20:46 +0000
commit509de69a7e7dde8165514b7f5c3685c33835969b (patch)
tree878441da510db554a1610123d0670ee02e346af3
parentbe478bb56ca6df214ddb2778158be24cad9af0b6 (diff)
downloadtor-509de69a7e7dde8165514b7f5c3685c33835969b.tar.gz
tor-509de69a7e7dde8165514b7f5c3685c33835969b.zip
reset warning flags on SIGHUP. arma: is this everything?
svn:r5192
-rw-r--r--src/or/main.c1
-rw-r--r--src/or/or.h1
-rw-r--r--src/or/routerlist.c35
3 files changed, 32 insertions, 5 deletions
diff --git a/src/or/main.c b/src/or/main.c
index 068e2d8819..1030ce204b 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -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 */
diff --git a/src/or/or.h b/src/or/or.h
index 0266fa8c0d..d897d2be5e 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -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);
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index d52a4be10b..810279b1b1 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -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 ||