diff options
author | Nick Mathewson <nickm@torproject.org> | 2017-04-21 15:37:38 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-04-21 15:42:09 -0400 |
commit | 900d36e3b101d9ac6ff854d4ec0ba8ac63369cc9 (patch) | |
tree | b1b31cbca59a4bc644a7bd766cd313fe04f3d4ff /src/or/directory.c | |
parent | d7fab3603760b40d4db2214b63e958714db5d818 (diff) | |
download | tor-900d36e3b101d9ac6ff854d4ec0ba8ac63369cc9.tar.gz tor-900d36e3b101d9ac6ff854d4ec0ba8ac63369cc9.zip |
Rename, revise, and document directory_request_is_dir_specified.
Diffstat (limited to 'src/or/directory.c')
-rw-r--r-- | src/or/directory.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/or/directory.c b/src/or/directory.c index 4a1b68c497..881069024d 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -1210,12 +1210,17 @@ directory_request_set_guard_state(directory_request_t *req, req->guard_state = state; } +/** + * Internal: Return true if any information for contacting the directory in + * <b>req</b> has been set, other than by the routerstatus. */ static int -directory_request_is_dir_specified(const directory_request_t *req) +directory_request_dir_contact_info_specified(const directory_request_t *req) { - // XXXX inline and revise - return (req->or_addr_port.port || req->dir_addr_port.port) && - ! tor_digest_is_zero(req->digest); + /* We only check for ports here, since we don't use an addr unless the port + * is set */ + return (req->or_addr_port.port || + req->dir_addr_port.port || + ! tor_digest_is_zero(req->digest)); } /** @@ -1301,7 +1306,8 @@ directory_initiate_request,(directory_request_t *request)) { tor_assert(request); if (request->routerstatus) { - tor_assert_nonfatal(! directory_request_is_dir_specified(request)); + tor_assert_nonfatal( + ! directory_request_dir_contact_info_specified(request)); if (directory_request_set_dir_from_routerstatus(request) < 0) { return; } |