summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2005-09-08 18:14:01 +0000
committerNick Mathewson <nickm@torproject.org>2005-09-08 18:14:01 +0000
commitff9452e90088c981edf8752d158034e615bc62a4 (patch)
tree979444c0176f2cd2ee1a5334bfe66d4223505902
parent3a99927859a16eee177ec934e116a57b92d60007 (diff)
downloadtor-ff9452e90088c981edf8752d158034e615bc62a4.tar.gz
tor-ff9452e90088c981edf8752d158034e615bc62a4.zip
Clean up should-i-go-to-the-dirserv logic a little: All servers with DirPorts should get their directories from the source
svn:r4930
-rw-r--r--src/or/directory.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/or/directory.c b/src/or/directory.c
index 1dc0a9fb45..60ca057906 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -113,7 +113,9 @@ purpose_is_private(uint8_t purpose)
{
if (purpose == DIR_PURPOSE_FETCH_DIR ||
purpose == DIR_PURPOSE_UPLOAD_DIR ||
- purpose == DIR_PURPOSE_FETCH_RUNNING_LIST)
+ purpose == DIR_PURPOSE_FETCH_RUNNING_LIST ||
+ purpose == DIR_PURPOSE_FETCH_NETWORKSTATUS ||
+ purpose == DIR_PURPOSE_FETCH_SERVERDESC)
return 0;
return 1;
}
@@ -162,12 +164,10 @@ directory_get_from_dirserver(uint8_t purpose, const char *resource,
routerinfo_t *r = NULL;
trusted_dir_server_t *ds = NULL;
int fascistfirewall = firewall_is_fascist();
- int directconn = purpose == DIR_PURPOSE_FETCH_DIR ||
- purpose == DIR_PURPOSE_FETCH_RUNNING_LIST ||
- purpose == DIR_PURPOSE_FETCH_NETWORKSTATUS ||
- purpose == DIR_PURPOSE_FETCH_SERVERDESC;
- int fetch_fresh_first = advertised_server_mode();
- int priv = purpose_is_private(purpose);
+ or_options_t *options = get_options();
+ int fetch_fresh_first = server_mode(options) && options->DirPort != 0;
+ int directconn = !purpose_is_private(purpose);
+
int need_v1_support = purpose == DIR_PURPOSE_FETCH_DIR ||
purpose == DIR_PURPOSE_FETCH_RUNNING_LIST;
int need_v2_support = purpose == DIR_PURPOSE_FETCH_NETWORKSTATUS ||
@@ -213,9 +213,9 @@ directory_get_from_dirserver(uint8_t purpose, const char *resource,
}
if (r)
- directory_initiate_command_router(r, purpose, priv, resource, NULL, 0);
+ directory_initiate_command_router(r, purpose, !directconn, resource, NULL, 0);
else if (ds)
- directory_initiate_command_trusted_dir(ds, purpose, priv, resource, NULL, 0);
+ directory_initiate_command_trusted_dir(ds, purpose, !directconn, resource, NULL, 0);
else {
log_fn(LOG_NOTICE,"No running dirservers known. Will try again later. (purpose %d)",
purpose);