aboutsummaryrefslogtreecommitdiff
path: root/src/or/main.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2013-06-13 12:42:49 -0400
committerNick Mathewson <nickm@torproject.org>2013-06-13 12:42:49 -0400
commit45424b2ca1638d5b3d147bb518c092a41028e259 (patch)
tree867615adfef97807842059ffb2fade77c08dc60b /src/or/main.c
parent4b781e24fb920ad4cd2268b609e4b4b0bd5adb7d (diff)
parentc132427db4f207a32e4abaae0e070840e5e2b808 (diff)
downloadtor-45424b2ca1638d5b3d147bb518c092a41028e259.tar
tor-45424b2ca1638d5b3d147bb518c092a41028e259.tar.gz
Merge remote-tracking branch 'linus/bug8532'
Diffstat (limited to 'src/or/main.c')
-rw-r--r--src/or/main.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/or/main.c b/src/or/main.c
index 90ffba36d..b2ff62879 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,17 @@ 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 networkstatus_dl_interval(o) ((o)->TestingTorNetwork ? 1 : 60)
+
+ if (time_to_download_networkstatus < now && !options->DisableNetwork) {
+ time_to_download_networkstatus = now + networkstatus_dl_interval(options);
update_networkstatus_downloads(now);
}