aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_hs_dos.c
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2019-08-12 12:32:38 -0400
committerGeorge Kadianakis <desnacked@riseup.net>2019-08-26 15:53:46 +0300
commit7faf10495fa50528fc8a9c45e729b9bc284fab19 (patch)
tree66cd768ebe45a5c952c52c9efedec68819e64359 /src/test/test_hs_dos.c
parent6c79172924a6a1660e55c29b7f2a205205ce0d21 (diff)
downloadtor-7faf10495fa50528fc8a9c45e729b9bc284fab19.tar.gz
tor-7faf10495fa50528fc8a9c45e729b9bc284fab19.zip
hs-v3: Rename INTRO2 consensus param getters
Make it clear that these functions return the consensus param only. Introduction point can not set those values with a torrc option. Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/test/test_hs_dos.c')
-rw-r--r--src/test/test_hs_dos.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/test/test_hs_dos.c b/src/test/test_hs_dos.c
index 3dfa057a4a..e2b211d5df 100644
--- a/src/test/test_hs_dos.c
+++ b/src/test/test_hs_dos.c
@@ -58,8 +58,9 @@ test_can_send_intro2(void *arg)
/* Make that circuit a service intro point. */
circuit_change_purpose(TO_CIRCUIT(or_circ), CIRCUIT_PURPOSE_INTRO_POINT);
/* Initialize the INTRODUCE2 token bucket for the rate limiting. */
- token_bucket_ctr_init(&or_circ->introduce2_bucket, hs_dos_get_intro2_rate(),
- hs_dos_get_intro2_burst(), now);
+ token_bucket_ctr_init(&or_circ->introduce2_bucket,
+ hs_dos_get_intro2_rate_param(),
+ hs_dos_get_intro2_burst_param(), now);
/* Brand new circuit, we should be able to send INTRODUCE2 cells. */
tt_int_op(true, OP_EQ, hs_dos_can_send_intro2(or_circ));
@@ -71,13 +72,13 @@ test_can_send_intro2(void *arg)
tt_int_op(true, OP_EQ, hs_dos_can_send_intro2(or_circ));
}
tt_uint_op(token_bucket_ctr_get(&or_circ->introduce2_bucket), OP_EQ,
- hs_dos_get_intro2_burst() - 10);
+ hs_dos_get_intro2_burst_param() - 10);
/* Fully refill the bucket minus 1 cell. */
update_approx_time(++now);
tt_int_op(true, OP_EQ, hs_dos_can_send_intro2(or_circ));
tt_uint_op(token_bucket_ctr_get(&or_circ->introduce2_bucket), OP_EQ,
- hs_dos_get_intro2_burst() - 1);
+ hs_dos_get_intro2_burst_param() - 1);
/* Receive an INTRODUCE2 at each second. We should have the bucket full
* since at every second it gets refilled. */
@@ -87,18 +88,18 @@ test_can_send_intro2(void *arg)
}
/* Last check if we can send the cell decrements the bucket so minus 1. */
tt_uint_op(token_bucket_ctr_get(&or_circ->introduce2_bucket), OP_EQ,
- hs_dos_get_intro2_burst() - 1);
+ hs_dos_get_intro2_burst_param() - 1);
/* Manually reset bucket for next test. */
token_bucket_ctr_reset(&or_circ->introduce2_bucket, now);
tt_uint_op(token_bucket_ctr_get(&or_circ->introduce2_bucket), OP_EQ,
- hs_dos_get_intro2_burst());
+ hs_dos_get_intro2_burst_param());
/* Do a full burst in the current second which should empty the bucket and
* we shouldn't be allowed to send one more cell after that. We go minus 1
* cell else the very last check if we can send the INTRO2 cell returns
* false because the bucket goes down to 0. */
- for (uint32_t i = 0; i < hs_dos_get_intro2_burst() - 1; i++) {
+ for (uint32_t i = 0; i < hs_dos_get_intro2_burst_param() - 1; i++) {
tt_int_op(true, OP_EQ, hs_dos_can_send_intro2(or_circ));
}
tt_uint_op(token_bucket_ctr_get(&or_circ->introduce2_bucket), OP_EQ, 1);
@@ -116,7 +117,7 @@ test_can_send_intro2(void *arg)
update_approx_time(++now);
tt_int_op(true, OP_EQ, hs_dos_can_send_intro2(or_circ));
tt_uint_op(token_bucket_ctr_get(&or_circ->introduce2_bucket), OP_EQ,
- hs_dos_get_intro2_rate() - 1);
+ hs_dos_get_intro2_rate_param() - 1);
done:
circuit_free_(TO_CIRCUIT(or_circ));