summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2010-03-16 04:02:18 -0400
committerRoger Dingledine <arma@torproject.org>2010-03-16 04:02:18 -0400
commitfe3380609e6444aadb88c534de0281d9d15d3c85 (patch)
tree6df1e25f38cb8db39e6f8388d61f83d94951caed
parent03b9c2cb903cc59f83139039d963f1fdea99b83a (diff)
downloadtor-fe3380609e6444aadb88c534de0281d9d15d3c85.tar.gz
tor-fe3380609e6444aadb88c534de0281d9d15d3c85.zip
In the glorious future, all relays cache dir info.
Now if you're a published relay and you set RefuseUnknownExits, even if your dirport is off, you'll fetch dir info from the authorities, fetch it early, and cache it. In the future, RefuseUnknownExits (or something like it) will be on by default.
-rw-r--r--src/or/dirserv.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index 5f1cb85431..b5c4c7b506 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -1122,12 +1122,12 @@ directory_fetches_from_authorities(or_options_t *options)
return 0;
if (server_mode(options) && router_pick_published_address(options, &addr)<0)
return 1; /* we don't know our IP address; ask an authority. */
- if (options->DirPort == 0)
+ if (options->DirPort == 0 && !options->RefuseUnknownExits)
return 0;
if (!server_mode(options) || !advertised_server_mode())
return 0;
me = router_get_my_routerinfo();
- if (!me || !me->dir_port)
+ if (!me || (!me->dir_port && !options->RefuseUnknownExits))
return 0; /* if dirport not advertised, return 0 too */
return 1;
}
@@ -1167,7 +1167,11 @@ directory_caches_v2_dir_info(or_options_t *options)
int
directory_caches_dir_info(or_options_t *options)
{
- return options->BridgeRelay != 0 || options->DirPort != 0;
+ if (options->BridgeRelay || options->DirPort)
+ return 1;
+ if (!server_mode(options) || !advertised_server_mode())
+ return 0;
+ return options->RefuseUnknownExits;
}
/** Return 1 if we want to allow remote people to ask us directory