diff options
author | Nick Mathewson <nickm@torproject.org> | 2007-08-20 15:59:31 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2007-08-20 15:59:31 +0000 |
commit | 9958dc8d5375b88cb6d07b168ff09a8d76acaa8e (patch) | |
tree | d8ccec6f38be2abb5f61dbe0b0f3e4439db2e826 /src/or/main.c | |
parent | d3b019a1df1b821cf4634ee289ec3d47d74c9a2a (diff) | |
download | tor-9958dc8d5375b88cb6d07b168ff09a8d76acaa8e.tar.gz tor-9958dc8d5375b88cb6d07b168ff09a8d76acaa8e.zip |
r14729@catbus: nickm | 2007-08-20 11:58:02 -0400
Trigger load and save of MTBF data.
svn:r11219
Diffstat (limited to 'src/or/main.c')
-rw-r--r-- | src/or/main.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/or/main.c b/src/or/main.c index aae07dfcf5..d97c74450a 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -845,6 +845,9 @@ run_scheduled_events(time_t now) static time_t time_to_add_entropy = 0; static time_t time_to_write_hs_statistics = 0; static time_t time_to_downrate_stability = 0; + /* XXXX020 this is way too low. */ +#define SAVE_STABILITY_INTERVAL (10*60) + static time_t time_to_save_stability = 0; or_options_t *options = get_options(); int i; int have_dir_info; @@ -935,6 +938,22 @@ run_scheduled_events(time_t now) /** 1d. DOCDOC */ if (time_to_downrate_stability < now) time_to_downrate_stability = rep_hist_downrate_old_runs(now); + if (authdir_mode_tests_reachability(options)) { + if (!time_to_save_stability) + time_to_save_stability = now + SAVE_STABILITY_INTERVAL; + if (time_to_save_stability < now) { + size_t len = strlen(options->DataDirectory)+32; + char *fn = tor_malloc(len); + tor_snprintf(fn, len, "%s"PATH_SEPARATOR"router-stability", + options->DataDirectory); + if (rep_hist_record_mtbf_data(fn)<0) { + log_warn(LD_GENERAL, "Couldn't store mtbf data in %s", fn); + } + tor_free(fn); + + time_to_save_stability = now + SAVE_STABILITY_INTERVAL; + } + } /** 2. Periodically, we consider getting a new directory, getting a * new running-routers list, and/or force-uploading our descriptor |