aboutsummaryrefslogtreecommitdiff
path: root/src/or/main.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-10-18 19:51:14 +0000
committerNick Mathewson <nickm@torproject.org>2007-10-18 19:51:14 +0000
commit5bfb4221570ba7dc5daeabb599936d442d6c1e40 (patch)
tree6ffb79f0d08acb223fa7fd799160094ebf1ae693 /src/or/main.c
parent0e0ca9700b634a0a4a98bf059cf7223896b68251 (diff)
downloadtor-5bfb4221570ba7dc5daeabb599936d442d6c1e40.tar.gz
tor-5bfb4221570ba7dc5daeabb599936d442d6c1e40.zip
r15934@catbus: nickm | 2007-10-18 15:32:56 -0400
When we have plenty of directory information, don't try to launch descriptor downloads quite so eagerly. svn:r12033
Diffstat (limited to 'src/or/main.c')
-rw-r--r--src/or/main.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/or/main.c b/src/or/main.c
index 37aefb46fc..c3bb3c3f6f 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -98,8 +98,12 @@ int has_completed_circuit=0;
/** How often do we check buffers and pools for empty space that can be
* deallocated? */
#define MEM_SHRINK_INTERVAL (60)
-/** How often do we check for router descriptors that we should download? */
-#define DESCRIPTOR_RETRY_INTERVAL (10)
+/** How often do we check for router descriptors that we should download
+ * when we have too little directory info? */
+#define GREEDY_DESCRIPTOR_RETRY_INTERVAL (10)
+/** How often do we check for router descriptors that we should download
+ * when we have enough directory info? */
+#define LAZY_DESCRIPTOR_RETRY_INTERVAL (60)
/** How often do we 'forgive' undownloadable router descriptors and attempt
* to download them again? */
#define DESCRIPTOR_FAILURE_RESET_INTERVAL (60*60)
@@ -859,13 +863,14 @@ run_scheduled_events(time_t now)
}
if (time_to_try_getting_descriptors < now) {
- /* XXXX Maybe we should do this every 10sec when not enough info,
- * and every 60sec when we have enough info -NM Great idea -RD */
update_router_descriptor_downloads(now);
update_extrainfo_downloads(now);
if (options->UseBridges)
fetch_bridge_descriptors(now);
- time_to_try_getting_descriptors = now + DESCRIPTOR_RETRY_INTERVAL;
+ if (router_have_minimum_dir_info())
+ time_to_try_getting_descriptors = now + LAZY_DESCRIPTOR_RETRY_INTERVAL;
+ else
+ time_to_try_getting_descriptors = now + GREEDY_DESCRIPTOR_RETRY_INTERVAL;
}
if (time_to_reset_descriptor_failures < now) {