aboutsummaryrefslogtreecommitdiff
path: root/src/or/rephist.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/or/rephist.c')
-rw-r--r--src/or/rephist.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/or/rephist.c b/src/or/rephist.c
index cd71eabc4..418fc8dd6 100644
--- a/src/or/rephist.c
+++ b/src/or/rephist.c
@@ -248,6 +248,45 @@ void rep_hist_dump_stats(time_t now, int severity)
}
}
+#if 0
+void write_rep_history(const char *filename)
+{
+ FILE *f = NULL;
+ char *tmpfile;
+ int completed = 0;
+ or_history_t *or_history;
+ link_history_t *link_history;
+ strmap_iter_t *lhist_it;
+ strmap_iter_t *orhist_it;
+ void *or_history_p, *link_history_p;
+ const char *name1;
+
+ tmpfile = tor_malloc(strlen(filename)+5);
+ strcpy(tmpfile, filename);
+ strcat(tmpfile, "_tmp");
+
+ f = fopen(tmpfile, "w");
+ if (!f) goto done;
+ for (orhist_it = strmap_iter_init(history_map); !strmap_iter_done(orhist_it);
+ orhist_it = strmap_iter_next(history_map,orhist_it)) {
+ strmap_iter_get(orhist_it, &name1, &or_history_p);
+ or_history = (or_history_t*) or_history_p;
+ fprintf(f, "link %s connected:u%ld failed:%uld uptime:%uld",
+ name1, or_history->since1,
+ }
+
+
+ done:
+ if (f)
+ fclose(f);
+ if (completed)
+ replace_file(filename, tmpfile);
+ else
+ unlink(tmpfile);
+ tor_free(tmpfile);
+}
+#endif
+
/*
Local Variables:
mode:c