Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Mike Perry
Tor
Commits
12d461a2
Commit
12d461a2
authored
Apr 10, 2006
by
Roger Dingledine
Browse files
make DirFetchPeriod and StatusFetchPeriod truly obsolete.
svn:r6373
parent
c2565c2f
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/or/config.c
View file @
12d461a2
...
...
@@ -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
);
...
...
src/or/main.c
View file @
12d461a2
...
...
@@ -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
...
...
src/or/or.h
View file @
12d461a2
...
...
@@ -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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment