summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2004-11-14 21:35:30 +0000
committerNick Mathewson <nickm@torproject.org>2004-11-14 21:35:30 +0000
commit2078b136f6a0015053e818e982be844e04571675 (patch)
tree86500091cf1c47fb14d9fb8086cee2b38f2f63a7
parent3f341fa1bdc4430662055279a8f108072354a8bc (diff)
downloadtor-2078b136f6a0015053e818e982be844e04571675.tar.gz
tor-2078b136f6a0015053e818e982be844e04571675.zip
Make running-routers fetch (apparently) work
svn:r2871
-rw-r--r--src/or/directory.c17
-rw-r--r--src/or/routerparse.c3
2 files changed, 14 insertions, 6 deletions
diff --git a/src/or/directory.c b/src/or/directory.c
index e763af1d05..4a9b212863 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -140,10 +140,10 @@ directory_post_to_dirservers(uint8_t purpose, const char *payload,
});
}
-/** Start a connection to a random running directory server, using
- * connection purpose 'purpose' requesting 'payload' (length
- * 'payload_len'). The purpose should be one of
- * 'DIR_PURPOSE_FETCH_DIR' or 'DIR_PURPOSE_FETCH_RENDDESC'.
+/** Start a connection to a random running directory server, using connection
+ * purpose 'purpose' requesting 'payload' (length 'payload_len'). The purpose
+ * should be one of 'DIR_PURPOSE_FETCH_DIR' or 'DIR_PURPOSE_FETCH_RENDDESC' or
+ * 'DIR_PURPOSE_FETCH_RUNNING_LIST.'
*/
void
directory_get_from_dirserver(uint8_t purpose, const char *resource)
@@ -163,6 +163,9 @@ directory_get_from_dirserver(uint8_t purpose, const char *resource)
ds = router_pick_trusteddirserver(1, get_options()->FascistFirewall);
}
}
+ } else if (purpose == DIR_PURPOSE_FETCH_RUNNING_LIST) {
+ /* right now, running-routers isn't cached, so ask a trusted directory */
+ ds = router_pick_trusteddirserver(0, get_options()->FascistFirewall);
} else { // (purpose == DIR_PURPOSE_FETCH_RENDDESC)
/* only ask authdirservers, any of them will do */
/* Never use fascistfirewall; we're going via Tor. */
@@ -241,6 +244,9 @@ directory_initiate_command(const char *address, uint32_t addr,
case DIR_PURPOSE_UPLOAD_RENDDESC:
log_fn(LOG_DEBUG,"initiating hidden-service descriptor upload");
break;
+ case DIR_PURPOSE_FETCH_RUNNING_LIST:
+ log_fn(LOG_DEBUG,"initiating running-routers fetch");
+ break;
default:
log_fn(LOG_ERR, "Unrecognized directory connection purpose.");
tor_assert(0);
@@ -270,7 +276,8 @@ directory_initiate_command(const char *address, uint32_t addr,
conn->state = DIR_CONN_STATE_CONNECTING;
if(purpose == DIR_PURPOSE_FETCH_DIR ||
- purpose == DIR_PURPOSE_UPLOAD_DIR) {
+ purpose == DIR_PURPOSE_UPLOAD_DIR ||
+ purpose == DIR_PURPOSE_FETCH_RUNNING_LIST) {
/* then we want to connect directly */
switch(connection_connect(conn, conn->address, addr, dir_port)) {
case -1:
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index bc5ae491ff..0a35bb0a8a 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -529,9 +529,10 @@ router_parse_runningrouters(const char *str)
for (i=0;i<tok->n_args;++i) {
smartlist_add(new_list->running_routers, tok->args[i]);
}
+ tok->n_args = 0; /* Don't free the elements of tok->args. */
if (!(tok = find_first_by_keyword(tokens, K_DIRECTORY_SIGNATURE))) {
- log_fn(LOG_WARN, "Missing signature on directory");
+ log_fn(LOG_WARN, "Missing signature on running-routers");
goto err;
}
declared_key = find_dir_signing_key(str);