diff options
author | Nick Mathewson <nickm@torproject.org> | 2017-04-21 14:31:35 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-04-21 14:31:35 -0400 |
commit | c300fd7e65b699c3d2704737cd0c73276ca0a346 (patch) | |
tree | 54786454ba7ab18c690b4f40b29b904a5189dfac /src/or | |
parent | a55bd00b0f41afca767a57e2da4a3dc6a26d2110 (diff) | |
download | tor-c300fd7e65b699c3d2704737cd0c73276ca0a346.tar.gz tor-c300fd7e65b699c3d2704737cd0c73276ca0a346.zip |
Have directory_get_from_all_authorities use requests.
Diffstat (limited to 'src/or')
-rw-r--r-- | src/or/directory.c | 16 | ||||
-rw-r--r-- | src/or/directory.h | 2 |
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); |