aboutsummaryrefslogtreecommitdiff
path: root/src/or/rephist.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2009-06-20 05:25:14 -0400
committerNick Mathewson <nickm@torproject.org>2009-06-30 10:10:13 -0400
commite7bc189f7c8fb4c2a490f10bd26d81893626ade1 (patch)
tree7216c347961397ba116e59d6a17c6a13107eb189 /src/or/rephist.c
parentbdca5476daa900813fcc3ad04b3e952dcaddc994 (diff)
downloadtor-e7bc189f7c8fb4c2a490f10bd26d81893626ade1.tar
tor-e7bc189f7c8fb4c2a490f10bd26d81893626ade1.tar.gz
the third piece of bug 969 fixing
when we write out our stability info, detect relays that have slipped through the cracks. log about them and correct the problem. if we continue to see a lot of these over time, it means there's another spot where relays fall out of the routerlist without being marked as unreachable.
Diffstat (limited to 'src/or/rephist.c')
-rw-r--r--src/or/rephist.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/or/rephist.c b/src/or/rephist.c
index 11e040c94..13fdb58b5 100644
--- a/src/or/rephist.c
+++ b/src/or/rephist.c
@@ -683,9 +683,13 @@ rep_history_clean(time_t before)
}
}
-/** Write MTBF data to disk. Returns 0 on success, negative on failure. */
+/** Write MTBF data to disk. Return 0 on success, negative on failure.
+ *
+ * If <b>missing_means_down</b>, then if we're about to write an entry
+ * that is still considered up but isn't in our routerlist, consider it
+ * to be down. */
int
-rep_hist_record_mtbf_data(void)
+rep_hist_record_mtbf_data(time_t now, int missing_means_down)
{
char time_buf[ISO_TIME_LEN+1];
@@ -745,6 +749,18 @@ rep_hist_record_mtbf_data(void)
hist = (or_history_t*) or_history_p;
base16_encode(dbuf, sizeof(dbuf), digest, DIGEST_LEN);
+
+ if (missing_means_down && hist->start_of_run &&
+ !router_get_by_digest(digest)) {
+ /* We think this relay is running, but it's not listed in our
+ * routerlist. Somehow it fell out without telling us it went
+ * down. Complain and also correct it. */
+ log_info(LD_HIST,
+ "Relay '%s' is listed as up in rephist, but it's not in "
+ "our routerlist. Correcting.", dbuf);
+ rep_hist_note_router_unreachable(digest, now);
+ }
+
PRINTF((f, "R %s\n", dbuf));
if (hist->start_of_run > 0) {
format_iso_time(time_buf, hist->start_of_run);