summaryrefslogtreecommitdiff
path: root/src/or/main.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2005-09-22 06:34:29 +0000
committerNick Mathewson <nickm@torproject.org>2005-09-22 06:34:29 +0000
commitcdc912714eeee2d72f72e1f4446daaa8804e12db (patch)
treef209e15c65bd3cce88e382b3338e61bd9ba6c21b /src/or/main.c
parent66930319473ff63796672f26d52890f60666e770 (diff)
downloadtor-cdc912714eeee2d72f72e1f4446daaa8804e12db.tar.gz
tor-cdc912714eeee2d72f72e1f4446daaa8804e12db.zip
I love the smell of C in the morning. Make router-download rules smarter (download more so long as we dont duplicate existing requests; relaunch at staggered intervals); relaunch one a minute or on failure; reset 60 minutes; always open 3 requests if we can; add authority opinion to networkstatus; make naming rule correct. There is a remaining bug where we retry servers too quickly; We need to look at that harder.
svn:r5110
Diffstat (limited to 'src/or/main.c')
-rw-r--r--src/or/main.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/or/main.c b/src/or/main.c
index 801742f6f9..869424e967 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -95,6 +95,8 @@ static char* nt_strerror(uint32_t errnum);
#define FORCE_REGENERATE_DESCRIPTOR_INTERVAL 18*60*60 /* 18 hours */
#define CHECK_DESCRIPTOR_INTERVAL 60 /* one minute */
#define BUF_SHRINK_INTERVAL 60 /* one minute */
+#define DESCRIPTOR_RETRY_INTERVAL 60
+#define DESCRIPTOR_FAILURE_RESET_INTERVAL 60*60
#define TIMEOUT_UNTIL_UNREACHABILITY_COMPLAINT (20*60) /* 20 minutes */
/********* END VARIABLES ************/
@@ -628,6 +630,8 @@ run_scheduled_events(time_t now)
static time_t time_to_check_listeners = 0;
static time_t time_to_check_descriptor = 0;
static time_t time_to_shrink_buffers = 0;
+ static time_t time_to_try_getting_descriptors = 0;
+ static time_t time_to_reset_descriptor_failures = 0;
or_options_t *options = get_options();
int i;
@@ -653,6 +657,16 @@ run_scheduled_events(time_t now)
router_upload_dir_desc_to_dirservers(0);
}
+ if (time_to_try_getting_descriptors < now) {
+ update_router_descriptor_downloads(now);
+ time_to_try_getting_descriptors = now + DESCRIPTOR_RETRY_INTERVAL;
+ }
+
+ if (time_to_reset_descriptor_failures < now) {
+ router_reset_descriptor_download_failures();
+ time_to_try_getting_descriptors = now + DESCRIPTOR_FAILURE_RESET_INTERVAL;
+ }
+
/** 1b. Every MAX_SSL_KEY_LIFETIME seconds, we change our TLS context. */
if (!last_rotated_certificate)
last_rotated_certificate = now;