summaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
authorteor (Tim Wilson-Brown) <teor2345@gmail.com>2016-07-01 10:08:38 +1000
committerteor (Tim Wilson-Brown) <teor2345@gmail.com>2016-07-01 14:00:20 +1000
commitd3ca6fe475ab5e0cc9c80e0ff984bebe4160f689 (patch)
treece1040253433625e0a773306e45af9558379065f /src/or
parentb4dcf56768e4b8c27fdade8f5f936dd7c651aeb0 (diff)
downloadtor-d3ca6fe475ab5e0cc9c80e0ff984bebe4160f689.tar.gz
tor-d3ca6fe475ab5e0cc9c80e0ff984bebe4160f689.zip
Call purpose_needs_anonymity in authority_certs_fetch_missing
Diffstat (limited to 'src/or')
-rw-r--r--src/or/directory.c2
-rw-r--r--src/or/directory.h4
-rw-r--r--src/or/routerlist.c8
3 files changed, 7 insertions, 7 deletions
diff --git a/src/or/directory.c b/src/or/directory.c
index 1fe4d6804d..68ec3b7503 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -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)
diff --git a/src/or/directory.h b/src/or/directory.h
index afa3bcc611..f04e7ab315 100644
--- a/src/or/directory.h
+++ b/src/or/directory.h
@@ -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,
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index 6ad276a913..cae0241343 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -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,