summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2006-04-10 20:16:46 +0000
committerRoger Dingledine <arma@torproject.org>2006-04-10 20:16:46 +0000
commit12d461a24562ec3efd9a379ffaa8ea2cb4e54b13 (patch)
tree4e435b69944c8c5eb6213615d60760a979f0089f
parentc2565c2ffb3e37e5e331632563edb212a3bc48b8 (diff)
downloadtor-12d461a24562ec3efd9a379ffaa8ea2cb4e54b13.tar.gz
tor-12d461a24562ec3efd9a379ffaa8ea2cb4e54b13.zip
make DirFetchPeriod and StatusFetchPeriod truly obsolete.
svn:r6373
-rw-r--r--src/or/config.c55
-rw-r--r--src/or/main.c40
-rw-r--r--src/or/or.h4
3 files changed, 6 insertions, 93 deletions
diff --git a/src/or/config.c b/src/or/config.c
index 1b77a4a7a9..938e9f5d0a 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -148,8 +148,7 @@ static config_var_t _option_vars[] = {
VAR("DebugLogFile", STRING, DebugLogFile, NULL),
VAR("DirAllowPrivateAddresses",BOOL, DirAllowPrivateAddresses, NULL),
VAR("DirListenAddress", LINELIST, DirListenAddress, NULL),
- /* if DirFetchPeriod is 0, see get_dir_fetch_period() in main.c */
- VAR("DirFetchPeriod", INTERVAL, DirFetchPeriod, "0 seconds"),
+ OBSOLETE("DirFetchPeriod"),
VAR("DirPolicy", LINELIST, DirPolicy, NULL),
VAR("DirPort", UINT, DirPort, "0"),
OBSOLETE("DirPostPeriod"),
@@ -227,8 +226,7 @@ static config_var_t _option_vars[] = {
VAR("SocksPolicy", LINELIST, SocksPolicy, NULL),
VAR("SocksPort", UINT, SocksPort, "9050"),
VAR("SocksTimeout", INTERVAL, SocksTimeout, "2 minutes"),
- /* if StatusFetchPeriod is 0, see get_status_fetch_period() in main.c */
- VAR("StatusFetchPeriod", INTERVAL, StatusFetchPeriod, "0 seconds"),
+ OBSOLETE("StatusFetchPeriod"),
VAR("StrictEntryNodes", BOOL, StrictEntryNodes, "0"),
VAR("StrictExitNodes", BOOL, StrictExitNodes, "0"),
VAR("SysLog", LINELIST_S, OldLogOptions, NULL),
@@ -1958,23 +1956,13 @@ validate_ports_csv(smartlist_t *sl, const char *name, char **msg)
return 0;
}
-/** Lowest allowable value for DirFetchPeriod; if this is too low, clients can
- * overload the directory system. */
-#define MIN_DIR_FETCH_PERIOD (10*60)
/** Lowest allowable value for RendPostPeriod; if this is too low, hidden
* services can overload the directory system. */
#define MIN_REND_POST_PERIOD (5*60)
-/** Lowest allowable value for StatusFetchPeriod; if this is too low, clients
- * can overload the directory system. */
-#define MIN_STATUS_FETCH_PERIOD (5*60)
/** Highest allowable value for DirFetchPeriod, StatusFetchPeriod, and
* RendPostPeriod. */
#define MAX_DIR_PERIOD (MIN_ONION_KEY_LIFETIME/2)
-/** Highest allowable value for DirFetchPeriod for directory caches. */
-#define MAX_CACHE_DIR_FETCH_PERIOD (60*60)
-/** Highest allowable value for StatusFetchPeriod for directory caches. */
-#define MAX_CACHE_STATUS_FETCH_PERIOD (15*60)
/** Return 0 if every setting in <b>options</b> is reasonable, and a
* permissible transition from <b>old_options</b>. Else return -1.
@@ -2291,51 +2279,12 @@ options_validate(or_options_t *old_options, or_options_t *options,
(options->PathlenCoinWeight < 0.0 || options->PathlenCoinWeight >= 1.0))
REJECT("PathlenCoinWeight option must be >=0.0 and <1.0.");
- if (options->DirFetchPeriod &&
- options->DirFetchPeriod < MIN_DIR_FETCH_PERIOD) {
- log(LOG_WARN, LD_CONFIG,
- "DirFetchPeriod option must be at least %d seconds. Clipping.",
- MIN_DIR_FETCH_PERIOD);
- options->DirFetchPeriod = MIN_DIR_FETCH_PERIOD;
- }
- if (options->StatusFetchPeriod &&
- options->StatusFetchPeriod < MIN_STATUS_FETCH_PERIOD) {
- log(LOG_WARN, LD_CONFIG,
- "StatusFetchPeriod option must be at least %d seconds. Clipping.",
- MIN_STATUS_FETCH_PERIOD);
- options->StatusFetchPeriod = MIN_STATUS_FETCH_PERIOD;
- }
if (options->RendPostPeriod < MIN_REND_POST_PERIOD) {
log(LOG_WARN,LD_CONFIG,"RendPostPeriod option must be at least %d seconds."
" Clipping.", MIN_REND_POST_PERIOD);
options->RendPostPeriod = MIN_REND_POST_PERIOD;
}
- if (options->DirPort && ! options->AuthoritativeDir) {
- if (options->DirFetchPeriod > MAX_CACHE_DIR_FETCH_PERIOD) {
- log(LOG_WARN, LD_CONFIG, "Caching directory servers must have "
- "DirFetchPeriod less than %d seconds. Clipping.",
- MAX_CACHE_DIR_FETCH_PERIOD);
- options->DirFetchPeriod = MAX_CACHE_DIR_FETCH_PERIOD;
- }
- if (options->StatusFetchPeriod > MAX_CACHE_STATUS_FETCH_PERIOD) {
- log(LOG_WARN, LD_CONFIG, "Caching directory servers must have "
- "StatusFetchPeriod less than %d seconds. Clipping.",
- MAX_CACHE_STATUS_FETCH_PERIOD);
- options->StatusFetchPeriod = MAX_CACHE_STATUS_FETCH_PERIOD;
- }
- }
-
- if (options->DirFetchPeriod > MAX_DIR_PERIOD) {
- log(LOG_WARN, LD_CONFIG, "DirFetchPeriod is too large; clipping to %ds.",
- MAX_DIR_PERIOD);
- options->DirFetchPeriod = MAX_DIR_PERIOD;
- }
- if (options->StatusFetchPeriod > MAX_DIR_PERIOD) {
- log(LOG_WARN, LD_CONFIG,"StatusFetchPeriod is too large; clipping to %ds.",
- MAX_DIR_PERIOD);
- options->StatusFetchPeriod = MAX_DIR_PERIOD;
- }
if (options->RendPostPeriod > MAX_DIR_PERIOD) {
log(LOG_WARN, LD_CONFIG, "RendPostPeriod is too large; clipping to %ds.",
MAX_DIR_PERIOD);
diff --git a/src/or/main.c b/src/or/main.c
index 20ebb9f13f..1185e05398 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -548,40 +548,6 @@ directory_all_unreachable(time_t now)
}
}
-/**
- * Return the interval to wait between directory downloads, in seconds.
- */
-static INLINE int
-get_dir_fetch_period(or_options_t *options)
-{
- if (options->DirFetchPeriod)
- /* Value from config file. */
- return options->DirFetchPeriod;
- else if (options->DirPort)
- /* Default for directory server */
- return 60*60;
- else
- /* Default for average user. */
- return 120*60;
-}
-
-/**
- * Return the interval to wait betweeen router status downloads, in seconds.
- */
-static INLINE int
-get_status_fetch_period(or_options_t *options)
-{
- if (options->StatusFetchPeriod)
- /* Value from config file. */
- return options->StatusFetchPeriod;
- else if (options->DirPort)
- /* Default for directory server */
- return 15*60;
- else
- /* Default for average user. */
- return 30*60;
-}
-
/** This function is called whenever we successfully pull down some new
* network statuses or server descriptors. */
void
@@ -830,7 +796,8 @@ run_scheduled_events(time_t now)
directory_get_from_dirserver(DIR_PURPOSE_FETCH_DIR, NULL, 1);
}
- time_to_fetch_directory = now + get_dir_fetch_period(options);
+#define V1_DIR_FETCH_PERIOD (60*60)
+ time_to_fetch_directory = now + V1_DIR_FETCH_PERIOD;
/* Also, take this chance to remove old information from rephist
* and the rend cache. */
@@ -846,7 +813,8 @@ run_scheduled_events(time_t now)
if (!authdir_mode(options) || !options->V1AuthoritativeDir) {
directory_get_from_dirserver(DIR_PURPOSE_FETCH_RUNNING_LIST, NULL, 1);
}
- time_to_fetch_running_routers = now + get_status_fetch_period(options);
+#define V1_RUNNINGROUTERS_FETCH_PERIOD (20*60)
+ time_to_fetch_running_routers = now + V1_RUNNINGROUTERS_FETCH_PERIOD;
}
/* 2b. Once per minute, regenerate and upload the descriptor if the old
diff --git a/src/or/or.h b/src/or/or.h
index 0accd821e0..e5c2db2121 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -1290,12 +1290,8 @@ typedef struct {
int TrackHostExitsExpire; /**< Number of seconds until we expire an
* addressmap */
config_line_t *AddressMap; /**< List of address map directives. */
- int DirFetchPeriod; /**< How often do we fetch new directories? */
- int DirPostPeriod; /**< How often do we post our server descriptor to the
- * authoritative directory servers? */
int RendPostPeriod; /**< How often do we post each rendezvous service
* descriptor? Remember to publish them independently. */
- int StatusFetchPeriod; /**< How often do we fetch running-routers lists? */
int KeepalivePeriod; /**< How often do we send padding cells to keep
* connections alive? */
int SocksTimeout; /**< How long do we let a socks connection wait