summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2006-01-06 18:19:17 +0000
committerNick Mathewson <nickm@torproject.org>2006-01-06 18:19:17 +0000
commit50b6b3258d50845bd1ce302105356fbfb4bfdcd0 (patch)
treee31a245671342a7c37337a6abac2a16c26f177e6
parentf0fb9f6b0cd63f3c84d1a58ad6f6355b3c2e211b (diff)
downloadtor-50b6b3258d50845bd1ce302105356fbfb4bfdcd0.tar.gz
tor-50b6b3258d50845bd1ce302105356fbfb4bfdcd0.zip
Dont call directory_get_from_dirserver when you have a particular dirserver in mind; remove fetch-from-authority special-case in directory_get_from_dirserver.
svn:r5741
-rw-r--r--src/or/directory.c14
-rw-r--r--src/or/routerlist.c7
2 files changed, 7 insertions, 14 deletions
diff --git a/src/or/directory.c b/src/or/directory.c
index 405e477761..91fd9c081c 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -157,7 +157,7 @@ directory_get_from_dirserver(uint8_t purpose, const char *resource,
{
routerstatus_t *rs = NULL;
or_options_t *options = get_options();
- int fetch_fresh_first = server_mode(options) && options->DirPort != 0;
+ int prefer_authority = server_mode(options) && options->DirPort != 0;
int directconn = !purpose_is_private(purpose);
int need_v1_support = purpose == DIR_PURPOSE_FETCH_DIR ||
@@ -166,17 +166,7 @@ directory_get_from_dirserver(uint8_t purpose, const char *resource,
purpose == DIR_PURPOSE_FETCH_SERVERDESC;
if (directconn) {
- if (fetch_fresh_first && purpose == DIR_PURPOSE_FETCH_NETWORKSTATUS &&
- !strcmpstart(resource,"fp/") && strlen(resource) >= HEX_DIGEST_LEN+3) {
- /* Try to ask the actual dirserver its opinion. */
- char digest[DIGEST_LEN];
- trusted_dir_server_t *ds;
- base16_decode(digest, DIGEST_LEN, resource+3, HEX_DIGEST_LEN);
- ds = router_get_trusteddirserver_by_digest(digest);
- if (ds)
- rs = &(ds->fake_status);
- }
- if (!rs && fetch_fresh_first) {
+ if (prefer_authority) {
/* only ask authdirservers, and don't ask myself */
rs = router_pick_trusteddirserver(need_v1_support, 1, 1,
retry_if_no_servers);
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index 9c0433c914..44139d1369 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -2225,8 +2225,11 @@ update_networkstatus_cache_downloads(time_t now)
strlcpy(resource, "fp/", sizeof(resource));
base16_encode(resource+3, sizeof(resource)-3, ds->digest, DIGEST_LEN);
strlcat(resource, ".z", sizeof(resource));
- directory_get_from_dirserver(DIR_PURPOSE_FETCH_NETWORKSTATUS,
- resource,1);
+ directory_initiate_command_routerstatus(
+ &ds->fake_status, DIR_PURPOSE_FETCH_NETWORKSTATUS,
+ 0, /* Not private */
+ resource,
+ NULL, 0 /* No payload. */);
});
} else {
/* A non-authority cache launches one connection to a random authority. */