summaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
Diffstat (limited to 'src/or')
-rw-r--r--src/or/directory.c16
-rw-r--r--src/or/directory.h2
2 files changed, 10 insertions, 8 deletions
diff --git a/src/or/directory.c b/src/or/directory.c
index ea3683d34b..1996e565b9 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -655,15 +655,17 @@ directory_get_from_all_authorities(uint8_t dir_purpose,
SMARTLIST_FOREACH_BEGIN(router_get_trusted_dir_servers(),
dir_server_t *, ds) {
- routerstatus_t *rs;
if (router_digest_is_me(ds->digest))
continue;
if (!(ds->type & V3_DIRINFO))
continue;
- rs = &ds->fake_status;
- directory_initiate_command_routerstatus(rs, dir_purpose, router_purpose,
- DIRIND_ONEHOP, resource, NULL,
- 0, 0, NULL);
+ const routerstatus_t *rs = &ds->fake_status;
+ directory_request_t *req = directory_request_new(dir_purpose);
+ directory_request_set_routerstatus(req, rs);
+ directory_request_set_router_purpose(req, router_purpose);
+ directory_request_set_resource(req, resource);
+ directory_initiate_request(req);
+ directory_request_free(req);
} SMARTLIST_FOREACH_END(ds);
}
@@ -1320,8 +1322,8 @@ directory_request_set_dir_from_routerstatus(directory_request_t *req)
return 0;
}
-void
-directory_initiate_request(directory_request_t *request)
+MOCK_IMPL(void,
+directory_initiate_request,(directory_request_t *request))
{
tor_assert(request);
if (request->routerstatus) {
diff --git a/src/or/directory.h b/src/or/directory.h
index 5d27767051..56bbfe4b4b 100644
--- a/src/or/directory.h
+++ b/src/or/directory.h
@@ -91,7 +91,7 @@ void directory_initiate_command_routerstatus_rend(const routerstatus_t *status,
const rend_data_t *rend_query,
struct circuit_guard_state_t *guard_state);
-void directory_initiate_request(directory_request_t *request);
+MOCK_DECL(void, directory_initiate_request, (directory_request_t *request));
int parse_http_response(const char *headers, int *code, time_t *date,
compress_method_t *compression, char **response);