diff options
author | Nick Mathewson <nickm@torproject.org> | 2013-02-05 00:33:04 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2013-02-05 00:33:04 -0500 |
commit | 2dcad03eba5ece3fa927623b41802a7ea11d95dd (patch) | |
tree | 81b356d0d3a5a8342f81e0ee52b14684852839bc | |
parent | 2c73fe5f5e8bce2f612e1bd60620f3bfbd1b847b (diff) | |
parent | cd4ad45ba31f4ae08aa185f358ee56721a06170b (diff) | |
download | tor-2dcad03eba5ece3fa927623b41802a7ea11d95dd.tar tor-2dcad03eba5ece3fa927623b41802a7ea11d95dd.tar.gz |
Merge remote-tracking branch 'public/bug8151'
-rw-r--r-- | changes/bug8151 | 5 | ||||
-rw-r--r-- | src/or/dirserv.c | 24 | ||||
-rw-r--r-- | src/or/dirserv.h | 1 | ||||
-rw-r--r-- | src/or/dirvote.c | 5 |
4 files changed, 35 insertions, 0 deletions
diff --git a/changes/bug8151 b/changes/bug8151 new file mode 100644 index 000000000..e20fa3c31 --- /dev/null +++ b/changes/bug8151 @@ -0,0 +1,5 @@ + o Minor features (directory authority): + - Include inside each vote a statement of the performance + thresholds that made the authority vote for its flags. Implements + ticket 8151. +
\ No newline at end of file diff --git a/src/or/dirserv.c b/src/or/dirserv.c index b59478e17..620984288 100644 --- a/src/or/dirserv.c +++ b/src/or/dirserv.c @@ -2059,6 +2059,30 @@ dirserv_compute_performance_thresholds(routerlist_t *rl, tor_free(wfus); } +/** Give a statement of our current performance thresholds for inclusion + * in a vote document. */ +char * +dirserv_get_flag_thresholds_line(void) +{ + char *result=NULL; + tor_asprintf(&result, + "stable-uptime=%lu stable-mtbf=%lu " + "fast-speed=%lu " + "guard-wfu=%.03f%% guard-tk=%lu " + "guard-bw-inc-exits=%lu guard-bw-exc-exits=%lu " + "enough-mtbf=%d", + (unsigned long)stable_uptime, + (unsigned long)stable_mtbf, + (unsigned long)fast_bandwidth, + guard_wfu*100, + (unsigned long)guard_tk, + (unsigned long)guard_bandwidth_including_exits, + (unsigned long)guard_bandwidth_excluding_exits, + enough_mtbf_info ? 1 : 0); + + return result; +} + /** Given a platform string as in a routerinfo_t (possibly null), return a * newly allocated version string for a networkstatus document, or NULL if the * platform doesn't give a Tor version. */ diff --git a/src/or/dirserv.h b/src/or/dirserv.h index 35b7bd016..add09f44a 100644 --- a/src/or/dirserv.h +++ b/src/or/dirserv.h @@ -70,6 +70,7 @@ int list_server_status_v1(smartlist_t *routers, char **router_status_out, int for_controller); int dirserv_dump_directory_to_string(char **dir_out, crypto_pk_t *private_key); +char *dirserv_get_flag_thresholds_line(void); int directory_fetches_from_authorities(const or_options_t *options); int directory_fetches_dir_info_early(const or_options_t *options); diff --git a/src/or/dirvote.c b/src/or/dirvote.c index aee9a6edf..43b9f5eb1 100644 --- a/src/or/dirvote.c +++ b/src/or/dirvote.c @@ -134,6 +134,8 @@ format_networkstatus_vote(crypto_pk_t *private_signing_key, char fu[ISO_TIME_LEN+1]; char vu[ISO_TIME_LEN+1]; char *flags = smartlist_join_strings(v3_ns->known_flags, " ", 0, NULL); + /* XXXX Abstraction violation: should be pulling a field out of v3_ns.*/ + char *flag_thresholds = dirserv_get_flag_thresholds_line(); char *params; authority_cert_t *cert = v3_ns->cert; char *methods = @@ -160,6 +162,7 @@ format_networkstatus_vote(crypto_pk_t *private_signing_key, "voting-delay %d %d\n" "%s" /* versions */ "known-flags %s\n" + "flag-thresholds %s\n" "params %s\n" "dir-source %s %s %s %s %d %d\n" "contact %s\n", @@ -169,6 +172,7 @@ format_networkstatus_vote(crypto_pk_t *private_signing_key, v3_ns->vote_seconds, v3_ns->dist_seconds, version_lines, flags, + flag_thresholds, params, voter->nickname, fingerprint, voter->address, fmt_addr32(addr), voter->dir_port, voter->or_port, @@ -181,6 +185,7 @@ format_networkstatus_vote(crypto_pk_t *private_signing_key, tor_free(params); tor_free(flags); + tor_free(flag_thresholds); tor_free(methods); outp = status + strlen(status); endp = status + len; |