aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2005-08-22 21:53:12 +0000
committerRoger Dingledine <arma@torproject.org>2005-08-22 21:53:12 +0000
commit676b330eb2b0923d1ee6c0307b3a155e6818bac0 (patch)
treee222526349c8b8dcbfcc90610cc87580c001514a /src
parent8adcd0bb3b5eb0bce65f067e6cda55a74f26e757 (diff)
downloadtor-676b330eb2b0923d1ee6c0307b3a155e6818bac0.tar
tor-676b330eb2b0923d1ee6c0307b3a155e6818bac0.tar.gz
Make DirPostPeriod config option obsolete.
Force new descriptor upload every 18 hours, not 24, to avoid races. Change rate-limiting on new descriptors due to bandwidth changes, from 45 minutes to 20 minutes. svn:r4814
Diffstat (limited to 'src')
-rw-r--r--src/or/config.c12
-rw-r--r--src/or/main.c17
-rw-r--r--src/or/router.c2
3 files changed, 6 insertions, 25 deletions
diff --git a/src/or/config.c b/src/or/config.c
index 0f66c5bf1..7ff000167 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -115,7 +115,7 @@ static config_var_t _option_vars[] = {
VAR("DirFetchPeriod", INTERVAL, DirFetchPeriod, "0 seconds"), /** DOCDOC **/
VAR("DirPolicy", LINELIST, DirPolicy, NULL),
VAR("DirPort", UINT, DirPort, "0"),
- VAR("DirPostPeriod", INTERVAL, DirPostPeriod, "20 minutes"),
+ OBSOLETE("DirPostPeriod"),
VAR("DirServer", LINELIST, DirServers, NULL),
VAR("EntryNodes", STRING, EntryNodes, NULL),
VAR("ExcludeNodes", STRING, ExcludeNodes, NULL),
@@ -1728,7 +1728,6 @@ options_validate(or_options_t *options)
}
#define MIN_DIR_FETCH_PERIOD 600
-#define MIN_DIR_POST_PERIOD 300
#define MIN_REND_POST_PERIOD 300
#define MIN_STATUS_FETCH_PERIOD 60
@@ -1746,11 +1745,6 @@ options_validate(or_options_t *options)
log(LOG_WARN, "StatusFetchPeriod option must be at least %d seconds. Clipping.", MIN_STATUS_FETCH_PERIOD);
options->StatusFetchPeriod = MIN_STATUS_FETCH_PERIOD;
}
- if (options->DirPostPeriod < MIN_DIR_POST_PERIOD) {
- log(LOG_WARN, "DirPostPeriod option must be at least %d seconds. Clipping.",
- MIN_DIR_POST_PERIOD);
- options->DirPostPeriod = MIN_DIR_POST_PERIOD;
- }
if (options->RendPostPeriod < MIN_REND_POST_PERIOD) {
log(LOG_WARN,"RendPostPeriod option must be at least %d seconds. Clipping.",
MIN_REND_POST_PERIOD);
@@ -1772,10 +1766,6 @@ options_validate(or_options_t *options)
log(LOG_WARN, "DirFetchPeriod is too large; clipping to %ds.", MAX_DIR_PERIOD);
options->DirFetchPeriod = MAX_DIR_PERIOD;
}
- if (options->DirPostPeriod > MAX_DIR_PERIOD) {
- log(LOG_WARN, "DirPostPeriod is too large; clipping to %ds.", MAX_DIR_PERIOD);
- options->DirPostPeriod = MAX_DIR_PERIOD;
- }
if (options->StatusFetchPeriod > MAX_DIR_PERIOD) {
log(LOG_WARN, "StatusFetchPeriod is too large; clipping to %ds.", MAX_DIR_PERIOD);
options->StatusFetchPeriod = MAX_DIR_PERIOD;
diff --git a/src/or/main.c b/src/or/main.c
index fa7b3687b..8a0182541 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -46,8 +46,6 @@ long time_of_process_start = 0;
long stats_n_seconds_working = 0;
/** When do we next download a directory? */
static time_t time_to_fetch_directory = 0;
-/** When do we next upload our descriptor? */
-static time_t time_to_force_upload_descriptor = 0;
/** When do we next download a running-routers summary? */
static time_t time_to_fetch_running_routers = 0;
@@ -94,7 +92,7 @@ static char* nt_strerror(uint32_t errnum);
#define nt_service_is_stopped() (0)
#endif
-#define FORCE_REGENERATE_DESCRIPTOR_INTERVAL 24*60*60 /* 1 day. */
+#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 TIMEOUT_UNTIL_UNREACHABILITY_COMPLAINT (20*60) /* 20 minutes */
@@ -545,9 +543,6 @@ directory_has_arrived(time_t now, char *identity_digest)
if (!time_to_fetch_directory)
time_to_fetch_directory = now + get_dir_fetch_period(options);
- if (!time_to_force_upload_descriptor)
- time_to_force_upload_descriptor = now + options->DirPostPeriod;
-
if (!time_to_fetch_running_routers)
time_to_fetch_running_routers = now + get_status_fetch_period(options);
@@ -709,8 +704,10 @@ run_scheduled_events(time_t now)
time_to_fetch_running_routers = next_status_fetch;
}
- /* Also, take this chance to remove old information from rephist. */
+ /* Also, take this chance to remove old information from rephist
+ * and the rend cache. */
rep_history_clean(now - options->RephistTrackTime);
+ rend_cache_clean();
}
if (time_to_fetch_running_routers < now) {
@@ -720,12 +717,6 @@ run_scheduled_events(time_t now)
time_to_fetch_running_routers = now + get_status_fetch_period(options);
}
- if (time_to_force_upload_descriptor < now) {
- /*XXXX this should go elsewhere. */
- rend_cache_clean(); /* this should go elsewhere? */
- time_to_force_upload_descriptor = now + options->DirPostPeriod;
- }
-
/* 2b. Once per minute, regenerate and upload the descriptor if the old
* one is inaccurate. */
if (time_to_check_descriptor < now) {
diff --git a/src/or/router.c b/src/or/router.c
index 247913c1e..b59acb5ef 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -792,7 +792,7 @@ mark_my_descriptor_dirty(void)
desc_clean_since = 0;
}
-#define MAX_BANDWIDTH_CHANGE_FREQ 45*60
+#define MAX_BANDWIDTH_CHANGE_FREQ 20*60
/** Check whether bandwidth has changed a lot since the last time we announced
* bandwidth. If so, mark our descriptor dirty.*/
void