aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Kadianakis <desnacked@riseup.net>2017-07-18 18:10:26 +0300
committerNick Mathewson <nickm@torproject.org>2017-08-08 20:29:34 -0400
commit6c00bd1f10f4683824deeaa7dd8a23aaf6b9a40e (patch)
treedef42a24e46a16e3eca4d3c9c1185217936f506a /src
parentcf58451a8ba03e869a805f973ef5b5f3f6d82b6b (diff)
downloadtor-6c00bd1f10f4683824deeaa7dd8a23aaf6b9a40e.tar.gz
tor-6c00bd1f10f4683824deeaa7dd8a23aaf6b9a40e.zip
prop224: Make prop224 time periods smaller in testnets.
It used to be that time periods were 24 hours long even on chutney, which made testing harder. With this commit, time periods have the same length as a full SRV protocol run, which means that they will change every 4 minutes in a 10-second voting interval chutney network!
Diffstat (limited to 'src')
-rw-r--r--src/or/hs_common.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/or/hs_common.c b/src/or/hs_common.c
index 0ae196d93e..9c3d2c1711 100644
--- a/src/or/hs_common.c
+++ b/src/or/hs_common.c
@@ -181,6 +181,17 @@ hs_check_service_private_dir(const char *username, const char *path,
STATIC uint64_t
get_time_period_length(void)
{
+ /* If we are on a test network, make the time period smaller than normal so
+ that we actually see it rotate. Specifically, make it the same length as
+ an SRV protocol run. */
+ if (get_options()->TestingTorNetwork) {
+ unsigned run_duration = sr_state_get_protocol_run_duration();
+ /* An SRV run should take more than a minute (it's 24 rounds) */
+ tor_assert_nonfatal(run_duration > 60);
+ /* Turn it from seconds to minutes before returning: */
+ return sr_state_get_protocol_run_duration() / 60;
+ }
+
int32_t time_period_length = networkstatus_get_param(NULL, "hsdir-interval",
HS_TIME_PERIOD_LENGTH_DEFAULT,
HS_TIME_PERIOD_LENGTH_MIN,