[or-cvs] make DirFetchPeriod and StatusFetchPeriod truly obsolete.
arma at seul.org
arma at seul.org
Mon Apr 10 20:16:49 UTC 2006
Update of /home2/or/cvsroot/tor/src/or
In directory moria:/home/arma/work/onion/cvs/tor/src/or
Modified Files:
config.c main.c or.h
Log Message:
make DirFetchPeriod and StatusFetchPeriod truly obsolete.
Index: config.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/config.c,v
retrieving revision 1.554
retrieving revision 1.555
diff -u -p -d -r1.554 -r1.555
--- config.c 10 Apr 2006 08:05:00 -0000 1.554
+++ config.c 10 Apr 2006 20:16:46 -0000 1.555
@@ -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, cons
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_optio
(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);
Index: main.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/main.c,v
retrieving revision 1.639
retrieving revision 1.640
diff -u -p -d -r1.639 -r1.640
--- main.c 27 Mar 2006 02:25:34 -0000 1.639
+++ main.c 10 Apr 2006 20:16:46 -0000 1.640
@@ -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
Index: or.h
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/or.h,v
retrieving revision 1.825
retrieving revision 1.826
diff -u -p -d -r1.825 -r1.826
--- or.h 10 Apr 2006 19:39:26 -0000 1.825
+++ or.h 10 Apr 2006 20:16:46 -0000 1.826
@@ -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
More information about the tor-commits
mailing list