summaryrefslogtreecommitdiff
path: root/src/or/routerlist.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2017-04-21 15:08:28 -0400
committerNick Mathewson <nickm@torproject.org>2017-04-21 15:08:28 -0400
commit8aadd60eac6d2b4feb176e34805b4bd5a8b77aed (patch)
tree17a30e24707bd2fc6efc635dd2a3d909cffb628f /src/or/routerlist.c
parent4e393f53188055e478c0292af504fb97d02a4ff2 (diff)
downloadtor-8aadd60eac6d2b4feb176e34805b4bd5a8b77aed.tar.gz
tor-8aadd60eac6d2b4feb176e34805b4bd5a8b77aed.zip
Replace remaining directory_initiate_command_* instances
Diffstat (limited to 'src/or/routerlist.c')
-rw-r--r--src/or/routerlist.c37
1 files changed, 21 insertions, 16 deletions
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index 0b0bb4b1d2..bff2cca048 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -947,6 +947,7 @@ authority_certs_fetch_resource_impl(const char *resource,
const dir_indirection_t indirection = get_via_tor ? DIRIND_ANONYMOUS
: DIRIND_ONEHOP;
+ directory_request_t *req = NULL;
/* If we've just downloaded a consensus from a bridge, re-use that
* bridge */
if (options->UseBridges && node && node->ri && !get_via_tor) {
@@ -955,23 +956,26 @@ authority_certs_fetch_resource_impl(const char *resource,
/* we are willing to use a non-preferred address if we need to */
fascist_firewall_choose_address_node(node, FIREWALL_OR_CONNECTION, 0,
&or_ap);
- directory_initiate_command(&or_ap.addr, or_ap.port,
- NULL, 0, /*no dirport*/
- dir_hint,
- DIR_PURPOSE_FETCH_CERTIFICATE,
- 0,
- indirection,
- resource, NULL, 0, 0);
- return;
+
+ req = directory_request_new(DIR_PURPOSE_FETCH_CERTIFICATE);
+ directory_request_set_or_addr_port(req, &or_ap);
+ if (dir_hint)
+ directory_request_set_directory_id_digest(req, dir_hint);
}
if (rs) {
/* If we've just downloaded a consensus from a directory, re-use that
* directory */
- directory_initiate_command_routerstatus(rs,
- DIR_PURPOSE_FETCH_CERTIFICATE,
- 0, indirection, resource, NULL,
- 0, 0, NULL);
+ req = directory_request_new(DIR_PURPOSE_FETCH_CERTIFICATE);
+ directory_request_set_routerstatus(req, rs);
+ }
+
+ if (req) {
+ /* Fill in the other request fields, and send the request. */
+ directory_request_set_indirection(req, indirection);
+ directory_request_set_resource(req, resource);
+ directory_initiate_request(req);
+ directory_request_free(req);
return;
}
@@ -4932,10 +4936,11 @@ MOCK_IMPL(STATIC void, initiate_descriptor_downloads,
if (source) {
/* We know which authority or directory mirror we want. */
- directory_initiate_command_routerstatus(source, purpose,
- ROUTER_PURPOSE_GENERAL,
- DIRIND_ONEHOP,
- resource, NULL, 0, 0, NULL);
+ directory_request_t *req = directory_request_new(purpose);
+ directory_request_set_routerstatus(req, source);
+ directory_request_set_resource(req, resource);
+ directory_initiate_request(req);
+ directory_request_free(req);
} else {
directory_get_from_dirserver(purpose, ROUTER_PURPOSE_GENERAL, resource,
pds_flags, DL_WANT_ANY_DIRSERVER);