summaryrefslogtreecommitdiff
path: root/src/feature
diff options
context:
space:
mode:
authorGeorge Kadianakis <desnacked@riseup.net>2019-04-18 13:23:32 +0300
committerGeorge Kadianakis <desnacked@riseup.net>2019-04-18 13:23:32 +0300
commit78223ab0fc279abe0c575f191f5d0f42ef1bda59 (patch)
treeedd638b89ae31dd40d48cba0a1cafa92c06f5c69 /src/feature
parent2db9bb02c79e023128e7b6fc89f4601b88e8ef4b (diff)
parent73323460023807259d3cd1dd52d33749ffe53886 (diff)
downloadtor-78223ab0fc279abe0c575f191f5d0f42ef1bda59.tar.gz
tor-78223ab0fc279abe0c575f191f5d0f42ef1bda59.zip
Merge branch 'tor-github/pr/938'
Diffstat (limited to 'src/feature')
-rw-r--r--src/feature/client/circpathbias.c4
-rw-r--r--src/feature/nodelist/node_select.c1
-rw-r--r--src/feature/relay/onion_queue.c10
3 files changed, 10 insertions, 5 deletions
diff --git a/src/feature/client/circpathbias.c b/src/feature/client/circpathbias.c
index 1743ab5a81..e6af649ba7 100644
--- a/src/feature/client/circpathbias.c
+++ b/src/feature/client/circpathbias.c
@@ -176,6 +176,7 @@ pathbias_get_scale_threshold(const or_options_t *options)
static double
pathbias_get_scale_ratio(const or_options_t *options)
{
+ (void) options;
/*
* The scale factor is the denominator for our scaling
* of circuit counts for our path bias window.
@@ -185,7 +186,8 @@ pathbias_get_scale_ratio(const or_options_t *options)
*/
int denominator = networkstatus_get_param(NULL, "pb_scalefactor",
2, 2, INT32_MAX);
- (void) options;
+ tor_assert(denominator > 0);
+
/**
* The mult factor is the numerator for our scaling
* of circuit counts for our path bias window. It
diff --git a/src/feature/nodelist/node_select.c b/src/feature/nodelist/node_select.c
index e31abb247f..93ddb066d4 100644
--- a/src/feature/nodelist/node_select.c
+++ b/src/feature/nodelist/node_select.c
@@ -585,6 +585,7 @@ compute_weighted_bandwidths(const smartlist_t *sl,
}
weight_scale = networkstatus_get_weight_scale_param(NULL);
+ tor_assert(weight_scale >= 1);
if (rule == WEIGHT_FOR_GUARD) {
Wg = networkstatus_get_bw_weight(NULL, "Wgg", -1);
diff --git a/src/feature/relay/onion_queue.c b/src/feature/relay/onion_queue.c
index 696905cf5e..c37745cf33 100644
--- a/src/feature/relay/onion_queue.c
+++ b/src/feature/relay/onion_queue.c
@@ -212,10 +212,12 @@ num_ntors_per_tap(void)
#define MIN_NUM_NTORS_PER_TAP 1
#define MAX_NUM_NTORS_PER_TAP 100000
- return networkstatus_get_param(NULL, "NumNTorsPerTAP",
- DEFAULT_NUM_NTORS_PER_TAP,
- MIN_NUM_NTORS_PER_TAP,
- MAX_NUM_NTORS_PER_TAP);
+ int result = networkstatus_get_param(NULL, "NumNTorsPerTAP",
+ DEFAULT_NUM_NTORS_PER_TAP,
+ MIN_NUM_NTORS_PER_TAP,
+ MAX_NUM_NTORS_PER_TAP);
+ tor_assert(result > 0);
+ return result;
}
/** Choose which onion queue we'll pull from next. If one is empty choose