[or-cvs] reset warning flags on SIGHUP. arma: is this everything?
Nick Mathewson
nickm at seul.org
Wed Oct 5 02:20:48 UTC 2005
Update of /home/or/cvsroot/tor/src/or
In directory moria:/tmp/cvs-serv7311/src/or
Modified Files:
main.c or.h routerlist.c
Log Message:
reset warning flags on SIGHUP. arma: is this everything?
Index: main.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/main.c,v
retrieving revision 1.568
retrieving revision 1.569
diff -u -d -r1.568 -r1.569
--- main.c 5 Oct 2005 02:06:36 -0000 1.568
+++ main.c 5 Oct 2005 02:20:45 -0000 1.569
@@ -929,6 +929,7 @@
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 */
Index: or.h
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/or.h,v
retrieving revision 1.704
retrieving revision 1.705
diff -u -d -r1.704 -r1.705
--- or.h 5 Oct 2005 02:06:36 -0000 1.704
+++ or.h 5 Oct 2005 02:20:45 -0000 1.705
@@ -2114,6 +2114,7 @@
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);
Index: routerlist.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/routerlist.c,v
retrieving revision 1.328
retrieving revision 1.329
diff -u -d -r1.328 -r1.329
--- routerlist.c 5 Oct 2005 02:06:36 -0000 1.328
+++ routerlist.c 5 Oct 2005 02:20:46 -0000 1.329
@@ -48,7 +48,7 @@
/** 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 @@
* 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 @@
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 @@
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 @@
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 ||
More information about the tor-commits
mailing list