[tor-commits] [tor/master] Rename, revise, and document directory_request_is_dir_specified.
nickm at torproject.org
nickm at torproject.org
Thu Apr 27 14:12:35 UTC 2017
commit 900d36e3b101d9ac6ff854d4ec0ba8ac63369cc9
Author: Nick Mathewson <nickm at torproject.org>
Date: Fri Apr 21 15:37:38 2017 -0400
Rename, revise, and document directory_request_is_dir_specified.
---
src/or/directory.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/src/or/directory.c b/src/or/directory.c
index 4a1b68c..8810690 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;
}
More information about the tor-commits
mailing list