new config option FetchDirInfoEarly for tup/ioerror and the tordnsel

svn:r12896
This commit is contained in:
Roger Dingledine
2007-12-21 06:08:00 +00:00
parent f0e7c4f0da
commit 9ebf86bb66
9 changed files with 36 additions and 21 deletions
+5 -4
View File
@@ -190,6 +190,7 @@ static config_var_t _option_vars[] = {
V(FascistFirewall, BOOL, "0"),
V(FirewallPorts, CSV, ""),
V(FastFirstHopPK, BOOL, "1"),
V(FetchDirInfoEarly, BOOL, "0"),
V(FetchServerDescriptors, BOOL, "1"),
V(FetchHidServDescriptors, BOOL, "1"),
V(FetchUselessDescriptors, BOOL, "0"),
@@ -1240,10 +1241,10 @@ options_act(or_options_t *old_options)
if (old_options) {
if (authdir_mode_v3(options) && !authdir_mode_v3(old_options))
dirvote_recalculate_timing(options, time(NULL));
if (!bool_eq(directory_fetches_dir_info_like_mirror(options),
directory_fetches_dir_info_like_mirror(old_options)) ||
!bool_eq(directory_fetches_dir_info_like_bridge_user(options),
directory_fetches_dir_info_like_bridge_user(old_options))) {
if (!bool_eq(directory_fetches_dir_info_early(options),
directory_fetches_dir_info_early(old_options)) ||
!bool_eq(directory_fetches_dir_info_later(options),
directory_fetches_dir_info_later(old_options))) {
/* Make sure update_router_have_min_dir_info gets called. */
router_dir_info_changed();
/* We might need to download a new consensus status later or sooner than
+4 -3
View File
@@ -1114,7 +1114,8 @@ dirserv_dump_directory_to_string(char **dir_out,
int
directory_fetches_from_authorities(or_options_t *options)
{
/* XXX if options->FetchDirInfoEagerly, return 1 */
if (options->FetchDirInfoEarly)
return 1;
if (options->DirPort == 0)
return 0;
if (options->BridgeRelay == 1)
@@ -1130,7 +1131,7 @@ directory_fetches_from_authorities(or_options_t *options)
* on the "mirror" schedule rather than the "client" schedule.
*/
int
directory_fetches_dir_info_like_mirror(or_options_t *options)
directory_fetches_dir_info_early(or_options_t *options)
{
return directory_fetches_from_authorities(options);
}
@@ -1142,7 +1143,7 @@ directory_fetches_dir_info_like_mirror(or_options_t *options)
* client as a directory guard.
*/
int
directory_fetches_dir_info_like_bridge_user(or_options_t *options)
directory_fetches_dir_info_later(or_options_t *options)
{
return options->UseBridges != 0;
}
+2 -2
View File
@@ -954,7 +954,7 @@ run_scheduled_events(time_t now)
* (if we've passed our internal checks). */
if (time_to_fetch_directory < now) {
/* Only caches actually need to fetch directories now. */
if (directory_fetches_dir_info_like_mirror(options) &&
if (directory_fetches_dir_info_early(options) &&
!authdir_mode_v1(options)) {
if (any_trusted_dir_is_v1_authority() &&
!should_delay_dir_fetches(options))
@@ -967,7 +967,7 @@ run_scheduled_events(time_t now)
}
/* Caches need to fetch running_routers; directory clients don't. */
if (directory_fetches_dir_info_like_mirror(options) &&
if (directory_fetches_dir_info_early(options) &&
time_to_fetch_running_routers < now) {
if (!authdir_mode_v1(options) && !should_delay_dir_fetches(options)) {
directory_get_from_dirserver(DIR_PURPOSE_FETCH_RUNNING_LIST,
+3 -3
View File
@@ -1063,7 +1063,7 @@ update_consensus_networkstatus_fetch_time(time_t now)
long dl_interval;
long interval = c->fresh_until - c->valid_after;
time_t start;
if (directory_fetches_dir_info_like_mirror(options)) {
if (directory_fetches_dir_info_early(options)) {
/* We want to cache the next one at some point after this one
* is no longer fresh... */
start = c->fresh_until + CONSENSUS_MIN_SECONDS_BEFORE_CACHING;
@@ -1078,7 +1078,7 @@ update_consensus_networkstatus_fetch_time(time_t now)
/* If we're a bridge user, make use of the numbers we just computed
* to choose the rest of the interval *after* them. */
if (directory_fetches_dir_info_like_bridge_user(options)) {
if (directory_fetches_dir_info_later(options)) {
/* Give all the *clients* enough time to download the consensus. */
start = start + dl_interval + CONSENSUS_MIN_SECONDS_BEFORE_CACHING;
/* But try to get it before ours actually expires. */
@@ -1133,7 +1133,7 @@ update_networkstatus_downloads(time_t now)
or_options_t *options = get_options();
if (should_delay_dir_fetches(options))
return;
if (directory_fetches_dir_info_like_mirror(options))
if (directory_fetches_dir_info_early(options))
update_v2_networkstatus_cache_downloads(now);
update_consensus_networkstatus_downloads(now);
update_certificate_downloads(now);
+5 -2
View File
@@ -2268,6 +2268,9 @@ typedef struct {
int RephistTrackTime; /**< How many seconds do we keep rephist info? */
int FastFirstHopPK; /**< If Tor believes it is safe, should we save a third
* of our PK time by sending CREATE_FAST cells? */
/** Should we always fetch our dir info on the mirror schedule (which
* means directly from the authorities) no matter our other config? */
int FetchDirInfoEarly;
addr_policy_t *reachable_addr_policy; /**< Parsed from ReachableAddresses */
@@ -3066,8 +3069,8 @@ int dirserv_dump_directory_to_string(char **dir_out,
crypto_pk_env_t *private_key);
int directory_fetches_from_authorities(or_options_t *options);
int directory_fetches_dir_info_like_mirror(or_options_t *options);
int directory_fetches_dir_info_like_bridge_user(or_options_t *options);
int directory_fetches_dir_info_early(or_options_t *options);
int directory_fetches_dir_info_later(or_options_t *options);
int directory_caches_v2_dir_info(or_options_t *options);
#define directory_caches_v1_dir_info(o) directory_caches_v2_dir_info(o)
int directory_caches_dir_info(or_options_t *options);
+3 -3
View File
@@ -3575,7 +3575,7 @@ launch_router_descriptor_downloads(smartlist_t *downloadable, time_t now)
or_options_t *options = get_options();
n_downloadable = smartlist_len(downloadable);
if (!directory_fetches_dir_info_like_mirror(options)) {
if (!directory_fetches_dir_info_early(options)) {
if (n_downloadable >= MAX_DL_TO_DELAY) {
log_debug(LD_DIR,
"There are enough downloadable routerdescs to launch requests.");
@@ -3642,7 +3642,7 @@ update_router_descriptor_cache_downloads_v2(time_t now)
or_options_t *options = get_options();
const smartlist_t *networkstatus_v2_list = networkstatus_get_v2_list();
if (! directory_fetches_dir_info_like_mirror(options)) {
if (! directory_fetches_dir_info_early(options)) {
log_warn(LD_BUG, "Called update_router_descriptor_cache_downloads_v2() "
"on a non-dir-mirror?");
}
@@ -3877,7 +3877,7 @@ update_router_descriptor_downloads(time_t now)
or_options_t *options = get_options();
if (should_delay_dir_fetches(options))
return;
if (directory_fetches_dir_info_like_mirror(options)) {
if (directory_fetches_dir_info_early(options)) {
update_router_descriptor_cache_downloads_v2(now);
}
update_consensus_router_descriptor_downloads(now);