diff options
author | Matthew Finkel <Matthew.Finkel@gmail.com> | 2014-10-29 00:29:48 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2015-12-18 13:14:09 -0500 |
commit | 0a7d22a664505c5235031fc2d3d792b83254b5ad (patch) | |
tree | 3236545e95744e96e0ac7ac4180a3c2ca3e63214 /src/or/nodelist.c | |
parent | 1ceb7142a131bd8706663d2b3c27d66a2dcb2a46 (diff) | |
download | tor-0a7d22a664505c5235031fc2d3d792b83254b5ad.tar.gz tor-0a7d22a664505c5235031fc2d3d792b83254b5ad.zip |
Client should check if dir server has open dir port or handles tunnelled requests
Final piece of prop 237. Closes 12538.
Diffstat (limited to 'src/or/nodelist.c')
-rw-r--r-- | src/or/nodelist.c | 17 |
1 files changed, 12 insertions, 5 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 |