[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor/master] Rename and relocate the bw weight scale param getter.
commit da5817772d6a10e1e842a6d8f72e6ba123bd29ec
Author: Mike Perry <mikeperry-git@xxxxxxxxxx>
Date: Wed Jan 30 22:41:10 2013 -0400
Rename and relocate the bw weight scale param getter.
It had nothing to do with circuit build times.
---
src/or/circuitstats.c | 10 ----------
src/or/networkstatus.c | 17 ++++++++++++++++-
src/or/networkstatus.h | 1 +
src/or/routerlist.c | 2 +-
src/or/routerparse.c | 2 +-
5 files changed, 19 insertions(+), 13 deletions(-)
diff --git a/src/or/circuitstats.c b/src/or/circuitstats.c
index 625083c..73e34d9 100644
--- a/src/or/circuitstats.c
+++ b/src/or/circuitstats.c
@@ -183,16 +183,6 @@ circuit_build_times_quantile_cutoff(void)
return num/100.0;
}
-/* DOCDOC circuit_build_times_get_bw_scale */
-int
-circuit_build_times_get_bw_scale(networkstatus_t *ns)
-{
- return networkstatus_get_param(ns, "bwweightscale",
- BW_WEIGHT_SCALE,
- BW_MIN_WEIGHT_SCALE,
- BW_MAX_WEIGHT_SCALE);
-}
-
/**
* Retrieve and bounds-check the cbtclosequantile consensus paramter.
*
diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c
index b45d402..71ac054 100644
--- a/src/or/networkstatus.c
+++ b/src/or/networkstatus.c
@@ -2239,6 +2239,21 @@ networkstatus_get_param(const networkstatus_t *ns, const char *param_name,
default_val, min_val, max_val);
}
+/**
+ * Retrieve the consensus parameter that governs the
+ * fixed-point precision of our network balancing 'bandwidth-weights'
+ * (which are themselves integer consensus values). We divide them
+ * by this value and ensure they never exceed this value.
+ */
+int
+networkstatus_get_weight_scale_param(networkstatus_t *ns)
+{
+ return networkstatus_get_param(ns, "bwweightscale",
+ BW_WEIGHT_SCALE,
+ BW_MIN_WEIGHT_SCALE,
+ BW_MAX_WEIGHT_SCALE);
+}
+
/** Return the value of a integer bw weight parameter from the networkstatus
* <b>ns</b> whose name is <b>weight_name</b>. If <b>ns</b> is NULL, try
* loading the latest consensus ourselves. Return <b>default_val</b> if no
@@ -2255,7 +2270,7 @@ networkstatus_get_bw_weight(networkstatus_t *ns, const char *weight_name,
if (!ns || !ns->weight_params)
return default_val;
- max = circuit_build_times_get_bw_scale(ns);
+ max = networkstatus_get_weight_scale_param(ns);
param = get_net_param_from_list(ns->weight_params, weight_name,
default_val, -1,
BW_MAX_WEIGHT_SCALE);
diff --git a/src/or/networkstatus.h b/src/or/networkstatus.h
index d6d6a03..b437c5e 100644
--- a/src/or/networkstatus.h
+++ b/src/or/networkstatus.h
@@ -112,6 +112,7 @@ int networkstatus_parse_flavor_name(const char *flavname);
void document_signature_free(document_signature_t *sig);
document_signature_t *document_signature_dup(const document_signature_t *sig);
void networkstatus_free_all(void);
+int networkstatus_get_weight_scale_param(networkstatus_t *ns);
#endif
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index 3034f91..8f19947 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -1734,7 +1734,7 @@ compute_weighted_bandwidths(const smartlist_t *sl,
return -1;
}
- weight_scale = circuit_build_times_get_bw_scale(NULL);
+ weight_scale = networkstatus_get_weight_scale_param(NULL);
if (rule == WEIGHT_FOR_GUARD) {
Wg = networkstatus_get_bw_weight(NULL, "Wgg", -1);
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index eaf015c..2a3de12 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -2255,7 +2255,7 @@ networkstatus_verify_bw_weights(networkstatus_t *ns)
const char *casename = NULL;
int valid = 1;
- weight_scale = circuit_build_times_get_bw_scale(ns);
+ weight_scale = networkstatus_get_weight_scale_param(ns);
Wgg = networkstatus_get_bw_weight(ns, "Wgg", -1);
Wgm = networkstatus_get_bw_weight(ns, "Wgm", -1);
Wgd = networkstatus_get_bw_weight(ns, "Wgd", -1);
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits