diff options
Diffstat (limited to 'src/or')
-rw-r--r-- | src/or/nodelist.c | 17 | ||||
-rw-r--r-- | src/or/routerlist.c | 2 |
2 files changed, 13 insertions, 6 deletions
diff --git a/src/or/nodelist.c b/src/or/nodelist.c index fc27207851..056d5e8cb9 100644 --- a/src/or/nodelist.c +++ b/src/or/nodelist.c @@ -644,12 +644,19 @@ node_is_named(const node_t *node) int node_is_dir(const node_t *node) { - if (node->rs) - return node->rs->dir_port != 0; - else if (node->ri) - return node->ri->dir_port != 0; - else + if (node->rs) { + routerstatus_t * rs = node->rs; + /* This is true if supports_tunnelled_dir_requests is true which + * indicates that we support directory request tunnelled or through the + * DirPort. */ + return rs->is_v2_dir; + } else if (node->ri) { + routerinfo_t * ri = node->ri; + /* Both tunnelled request is supported or DirPort is set. */ + return ri->supports_tunnelled_dir_requests; + } else { return 0; + } } /** Return true iff <b>node</b> has either kind of usable descriptor -- that diff --git a/src/or/routerlist.c b/src/or/routerlist.c index c45854c52f..df6d797e0d 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -1512,7 +1512,7 @@ router_pick_directory_server_impl(dirinfo_type_t type, int flags, if (!status) continue; - if (!node->is_running || !status->dir_port || !node->is_valid) + if (!node->is_running || !node_is_dir(node) || !node->is_valid) continue; if (requireother && router_digest_is_me(node->identity)) continue; |