aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorMike Perry <mikeperry-git@torproject.org>2023-06-20 23:25:27 +0000
committerMike Perry <mikeperry-git@torproject.org>2023-06-23 15:08:54 +0000
commit646212ce586a3cc9badf2c268cbc450b207d03c6 (patch)
tree534a208e3ed10ccf994bba23f25710a7c11278de /src/core
parent9d022be9fcdf82a107336cdf8e5c77413a699b5f (diff)
downloadtor-646212ce586a3cc9badf2c268cbc450b207d03c6.tar.gz
tor-646212ce586a3cc9badf2c268cbc450b207d03c6.zip
Bug 40709: Update and clean up tests for consensus params
Diffstat (limited to 'src/core')
-rw-r--r--src/core/or/congestion_control_common.c15
-rw-r--r--src/core/or/congestion_control_common.h3
2 files changed, 14 insertions, 4 deletions
diff --git a/src/core/or/congestion_control_common.c b/src/core/or/congestion_control_common.c
index ece93a3370..6ef29ba637 100644
--- a/src/core/or/congestion_control_common.c
+++ b/src/core/or/congestion_control_common.c
@@ -90,9 +90,6 @@ static bool congestion_control_update_circuit_bdp(congestion_control_t *,
const circuit_t *,
const crypt_path_t *,
uint64_t, uint64_t);
-/* For unit tests */
-void congestion_control_set_cc_enabled(void);
-
/* Number of times the RTT value was reset. For MetricsPort. */
static uint64_t num_rtt_reset;
@@ -387,6 +384,7 @@ congestion_control_enabled(void)
return cc_alg != CC_ALG_SENDME;
}
+#ifdef TOR_UNIT_TESTS
/**
* For unit tests only: set the cached consensus cc alg to
* specified value.
@@ -398,6 +396,17 @@ congestion_control_set_cc_enabled(void)
}
/**
+ * For unit tests only: set the cached consensus cc alg to
+ * specified value.
+ */
+void
+congestion_control_set_cc_disabled(void)
+{
+ cc_alg = CC_ALG_SENDME;
+}
+#endif
+
+/**
* Allocate and initialize fields in congestion control object.
*
* cc_alg is the negotiated congestion control algorithm.
diff --git a/src/core/or/congestion_control_common.h b/src/core/or/congestion_control_common.h
index cf3e9d4fdb..767e4c52e6 100644
--- a/src/core/or/congestion_control_common.h
+++ b/src/core/or/congestion_control_common.h
@@ -174,7 +174,7 @@ percent_max_mix(uint64_t a, uint64_t b, uint8_t pct_max)
}
/* Private section starts. */
-#ifdef TOR_CONGESTION_CONTROL_PRIVATE
+#ifdef TOR_CONGESTION_CONTROL_COMMON_PRIVATE
/*
* Unit tests declaractions.
@@ -182,6 +182,7 @@ percent_max_mix(uint64_t a, uint64_t b, uint8_t pct_max)
#ifdef TOR_UNIT_TESTS
void congestion_control_set_cc_enabled(void);
+void congestion_control_set_cc_disabled(void);
#endif /* defined(TOR_UNIT_TESTS) */