Call purpose_needs_anonymity in authority_certs_fetch_missing

This commit is contained in:
teor (Tim Wilson-Brown) 2016-07-01 10:08:38 +10:00
parent b4dcf56768
commit d3ca6fe475
No known key found for this signature in database
GPG Key ID: 450CBA7F968F094B
3 changed files with 7 additions and 7 deletions

View File

@ -122,7 +122,7 @@ static void connection_dir_close_consensus_fetches(
/** Return true iff the directory purpose <b>dir_purpose</b> (and if it's
* fetching descriptors, it's fetching them for <b>router_purpose</b>)
* must use an anonymous connection to a directory. */
STATIC int
int
purpose_needs_anonymity(uint8_t dir_purpose, uint8_t router_purpose)
{
if (get_options()->AllDirActionsPrivate)

View File

@ -132,12 +132,12 @@ int download_status_get_n_failures(const download_status_t *dls);
int download_status_get_n_attempts(const download_status_t *dls);
time_t download_status_get_next_attempt_at(const download_status_t *dls);
int purpose_needs_anonymity(uint8_t dir_purpose, uint8_t router_purpose);
#ifdef TOR_UNIT_TESTS
/* Used only by directory.c and test_dir.c */
STATIC int parse_http_url(const char *headers, char **url);
STATIC int purpose_needs_anonymity(uint8_t dir_purpose,
uint8_t router_purpose);
STATIC dirinfo_type_t dir_fetch_type(int dir_purpose, int router_purpose,
const char *resource);
STATIC int directory_handle_command_get(dir_connection_t *conn,

View File

@ -1076,8 +1076,8 @@ authority_certs_fetch_missing(networkstatus_t *status, time_t now,
/* If we've just downloaded a consensus from a directory, re-use that
* directory */
if (rs) {
/* Certificate fetches are one-hop, unless AllDirActionsPrivate is 1 */
int get_via_tor = options->AllDirActionsPrivate;
int get_via_tor = purpose_needs_anonymity(
DIR_PURPOSE_FETCH_CERTIFICATE, 0);
const dir_indirection_t indirection = get_via_tor ? DIRIND_ANONYMOUS
: DIRIND_ONEHOP;
directory_initiate_command_routerstatus(rs,
@ -1137,8 +1137,8 @@ authority_certs_fetch_missing(networkstatus_t *status, time_t now,
/* If we've just downloaded a consensus from a directory, re-use that
* directory */
if (rs) {
/* Certificate fetches are one-hop, unless AllDirActionsPrivate is 1 */
int get_via_tor = options->AllDirActionsPrivate;
int get_via_tor = purpose_needs_anonymity(
DIR_PURPOSE_FETCH_CERTIFICATE, 0);
const dir_indirection_t indirection = get_via_tor ? DIRIND_ANONYMOUS
: DIRIND_ONEHOP;
directory_initiate_command_routerstatus(rs,