aboutsummaryrefslogtreecommitdiff
path: root/src/or/directory.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2005-01-10 17:39:41 +0000
committerRoger Dingledine <arma@torproject.org>2005-01-10 17:39:41 +0000
commit45eb8d9660681ef0f948c4c22d38fc4319aa000e (patch)
tree1b27e591b42c454e419a686facdee2a737821cf3 /src/or/directory.c
parent74bc4e5af02a569652a2bf4892117bc44887ad0b (diff)
downloadtor-45eb8d9660681ef0f948c4c22d38fc4319aa000e.tar.gz
tor-45eb8d9660681ef0f948c4c22d38fc4319aa000e.zip
if you're a server and the auth dirservers are down, go to any other
server. only give up hope on network reachability when no other servers are reachable either. svn:r3335
Diffstat (limited to 'src/or/directory.c')
-rw-r--r--src/or/directory.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/or/directory.c b/src/or/directory.c
index c6ec9a58b9..05e354ac7b 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -153,14 +153,17 @@ directory_get_from_dirserver(uint8_t purpose, const char *resource,
routerinfo_t *r = NULL;
trusted_dir_server_t *ds = NULL;
int fascistfirewall = get_options()->FascistFirewall;
+ int directconn = purpose == DIR_PURPOSE_FETCH_DIR ||
+ purpose == DIR_PURPOSE_FETCH_RUNNING_LIST;
+ int fetch_fresh_first = advertised_server_mode();
- if (purpose == DIR_PURPOSE_FETCH_DIR ||
- purpose == DIR_PURPOSE_FETCH_RUNNING_LIST) {
- if (advertised_server_mode()) {
+ if (directconn) {
+ if (fetch_fresh_first) {
/* only ask authdirservers, and don't ask myself */
ds = router_pick_trusteddirserver(1, fascistfirewall,
retry_if_no_servers);
- } else {
+ }
+ if (!ds) {
/* anybody with a non-zero dirport will do */
r = router_pick_directory_server(1, fascistfirewall,
purpose==DIR_PURPOSE_FETCH_RUNNING_LIST,
@@ -184,8 +187,12 @@ directory_get_from_dirserver(uint8_t purpose, const char *resource,
else if (ds)
directory_initiate_command_trusted_dir(ds, purpose, resource, NULL, 0);
else {
- log_fn(LOG_NOTICE,"No running dirservers known. Not trying. (purpose %d)", purpose);
- directory_all_unreachable(time(NULL)); /* remember we tried them all and failed. */
+ log_fn(LOG_NOTICE,"No running dirservers known. Not trying. (purpose %d)",
+ purpose);
+ if(directconn) {
+ /* remember we tried them all and failed. */
+ directory_all_unreachable(time(NULL));
+ }
}
}