aboutsummaryrefslogtreecommitdiff
path: root/src/or/main.c
diff options
context:
space:
mode:
authorLinus Nordberg <linus@torproject.org>2013-06-05 15:48:57 +0200
committerLinus Nordberg <linus@torproject.org>2013-06-08 15:25:32 +0200
commit4d54b9774d11f47c6a670ab9b380e027a524f5f9 (patch)
tree6256b3849c531a7ff05914e6055f24b6befdbc06 /src/or/main.c
parentbcdc0022693c75ea1523468e783bf03832e0a358 (diff)
downloadtor-4d54b9774d11f47c6a670ab9b380e027a524f5f9.tar
tor-4d54b9774d11f47c6a670ab9b380e027a524f5f9.tar.gz
Add support for offsetting the voting interval in order to bootstrap faster.
A new option TestingV3AuthVotingStartOffset is added which offsets the starting time of the voting interval. This is possible only when TestingTorNetwork is set. This patch makes run_scheduled_events() check for new consensus downloads every second when TestingTorNetwork, instead of every minute. This should be fine, see #8532 for reasoning. This patch also brings MIN_VOTE_SECONDS and MIN_DIST_SECONDS down from 20 to 2 seconds, unconditionally. This makes sanity checking of misconfiguration slightly less sane. Addresses #8532.
Diffstat (limited to 'src/or/main.c')
-rw-r--r--src/or/main.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/or/main.c b/src/or/main.c
index 90ffba36d..9e4efefdb 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -1153,6 +1153,7 @@ run_scheduled_events(time_t now)
static time_t time_to_check_v3_certificate = 0;
static time_t time_to_check_listeners = 0;
static time_t time_to_check_descriptor = 0;
+ static time_t time_to_download_networkstatus = 0;
static time_t time_to_shrink_memory = 0;
static time_t time_to_try_getting_descriptors = 0;
static time_t time_to_reset_descriptor_failures = 0;
@@ -1442,10 +1443,18 @@ run_scheduled_events(time_t now)
networkstatus_v2_list_clean(now);
/* Remove dead routers. */
routerlist_remove_old_routers();
+ }
- /* Also, once per minute, check whether we want to download any
- * networkstatus documents.
- */
+ /* 2c. Every minute (or every second if TestingTorNetwork), check
+ * whether we want to download any networkstatus documents. */
+
+/* How often do we check whether we should download network status
+ * documents? */
+#define CHECK_NETWORKSTATUS_DOWNLOAD_INTERVAL (60)
+
+ if (time_to_download_networkstatus < now && !options->DisableNetwork) {
+ time_to_download_networkstatus = now +
+ options->TestingTorNetwork ? 1 : CHECK_NETWORKSTATUS_DOWNLOAD_INTERVAL;
update_networkstatus_downloads(now);
}