aboutsummaryrefslogtreecommitdiff
path: root/src/or/dirserv.c
diff options
context:
space:
mode:
authorMatthew Finkel <Matthew.Finkel@gmail.com>2013-10-02 02:46:24 +0000
committerMatthew Finkel <Matthew.Finkel@gmail.com>2013-10-21 17:49:33 +0000
commitb36f93a6711aa3c763d1ea0765862cd2f6939756 (patch)
tree3e26ee77484cfb521bcf2b69e9ab012553e6e53f /src/or/dirserv.c
parentb7a17de454c9c2721059393d237f3984bd5aa74f (diff)
downloadtor-b36f93a6711aa3c763d1ea0765862cd2f6939756.tar
tor-b36f93a6711aa3c763d1ea0765862cd2f6939756.tar.gz
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/dirserv.c')
-rw-r--r--src/or/dirserv.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index d30a47436..8d2da5b50 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -1957,6 +1957,10 @@ dirserv_compute_performance_thresholds(routerlist_t *rl,
/* Now, fill in the arrays. */
SMARTLIST_FOREACH_BEGIN(nodelist_get_list(), node_t *, node) {
+ if (options->BridgeAuthoritativeDir &&
+ node->ri &&
+ node->ri->purpose != ROUTER_PURPOSE_BRIDGE)
+ continue;
if (router_counts_toward_thresholds(node, now, omit_as_sybil,
require_mbw)) {
routerinfo_t *ri = node->ri;
@@ -2071,6 +2075,21 @@ dirserv_compute_performance_thresholds(routerlist_t *rl,
tor_free(wfus);
}
+/* Use dirserv_compute_performance_thresholds() to compute the thresholds
+ * for the status flags, specifically for bridges.
+ *
+ * This is only called by a Bridge Authority from
+ * networkstatus_getinfo_by_purpose().
+ */
+void
+dirserv_compute_bridge_flag_thresholds(routerlist_t *rl)
+{
+
+ digestmap_t *omit_as_sybil = digestmap_new();
+ dirserv_compute_performance_thresholds(rl, omit_as_sybil);
+ digestmap_free(omit_as_sybil, NULL);
+}
+
/** Measured bandwidth cache entry */
typedef struct mbw_cache_entry_s {
long mbw_kb;