diff options
author | Matthew Finkel <Matthew.Finkel@gmail.com> | 2013-10-02 02:46:24 +0000 |
---|---|---|
committer | Matthew Finkel <Matthew.Finkel@gmail.com> | 2013-10-21 17:49:33 +0000 |
commit | b36f93a6711aa3c763d1ea0765862cd2f6939756 (patch) | |
tree | 3e26ee77484cfb521bcf2b69e9ab012553e6e53f /src/or/networkstatus.c | |
parent | b7a17de454c9c2721059393d237f3984bd5aa74f (diff) | |
download | tor-b36f93a6711aa3c763d1ea0765862cd2f6939756.tar.gz tor-b36f93a6711aa3c763d1ea0765862cd2f6939756.zip |
A Bridge Authority should compute flag thresholds
As a bridge authority, before we create our networkstatus document, we
should compute the thresholds needed for the various status flags
assigned to each bridge based on the status of all other bridges. We
then add these thresholds to the networkstatus document for easy access.
Fixes for #1117 and #9859.
Diffstat (limited to 'src/or/networkstatus.c')
-rw-r--r-- | src/or/networkstatus.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c index c950731bb2..a935a4672c 100644 --- a/src/or/networkstatus.c +++ b/src/or/networkstatus.c @@ -2171,9 +2171,17 @@ networkstatus_dump_bridge_status_to_file(time_t now) char *status = networkstatus_getinfo_by_purpose("bridge", now); const or_options_t *options = get_options(); char *fname = NULL; + char *thresholds = NULL, *thresholds_and_status = NULL; + routerlist_t *rl = router_get_routerlist(); + dirserv_compute_bridge_flag_thresholds(rl); + thresholds = dirserv_get_flag_thresholds_line(); + tor_asprintf(&thresholds_and_status, "flag-thresholds %s\n%s", + thresholds, status); tor_asprintf(&fname, "%s"PATH_SEPARATOR"networkstatus-bridges", options->DataDirectory); - write_str_to_file(fname,status,0); + write_str_to_file(fname,thresholds_and_status,0); + tor_free(thresholds); + tor_free(thresholds_and_status); tor_free(fname); tor_free(status); } |