aboutsummaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2008-01-18 04:42:22 +0000
committerRoger Dingledine <arma@torproject.org>2008-01-18 04:42:22 +0000
commit06047bcec9bab8ec2af9dcdd0b3277d36680f9d8 (patch)
treee44618beb61d899f4b5827ce361043d07ada45a1 /src/or
parent200ce2030c30ef9f4d77605807f75dc8df88bcdd (diff)
downloadtor-06047bcec9bab8ec2af9dcdd0b3277d36680f9d8.tar.gz
tor-06047bcec9bab8ec2af9dcdd0b3277d36680f9d8.zip
Avoid going directly to the directory authorities even if you're a
relay, if you haven't found yourself reachable yet or if you've decided not to advertise your dirport yet. Addresses bug 556. svn:r13172
Diffstat (limited to 'src/or')
-rw-r--r--src/or/dirserv.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index ab0d17d7a9..e66cb2aa5b 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -1116,16 +1116,18 @@ dirserv_dump_directory_to_string(char **dir_out,
int
directory_fetches_from_authorities(or_options_t *options)
{
+ routerinfo_t *me;
if (options->FetchDirInfoEarly)
return 1;
if (options->DirPort == 0)
return 0;
if (options->BridgeRelay == 1)
return 0;
- /* XXX if dirport not advertised, return 0 too */
- if (!server_mode(options))
+ if (!server_mode(options) || !advertised_server_mode())
return 0;
- /* XXX if orport or dirport not reachable, return 0 too */
+ me = router_get_my_routerinfo();
+ if (!me || !me->dir_port)
+ return 0; /* if dirport not advertised, return 0 too */
return 1;
}