summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2005-09-08 18:46:25 +0000
committerNick Mathewson <nickm@torproject.org>2005-09-08 18:46:25 +0000
commit1e2f1679c8e2ba9bad14e6070bd6b06e161813de (patch)
treeee1dbfc23f53ad08e27ec26fa3c01ae3f0f225dc
parenteab005c9480b9b24bdc7572cb34b0b766c1d9301 (diff)
downloadtor-1e2f1679c8e2ba9bad14e6070bd6b06e161813de.tar.gz
tor-1e2f1679c8e2ba9bad14e6070bd6b06e161813de.zip
Fix some more bugs; add a temporary log.
svn:r4936
-rw-r--r--src/or/directory.c10
-rw-r--r--src/or/routerlist.c10
-rw-r--r--src/or/routerparse.c2
3 files changed, 15 insertions, 7 deletions
diff --git a/src/or/directory.c b/src/or/directory.c
index 60ca057906..034cda78ac 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -175,11 +175,14 @@ directory_get_from_dirserver(uint8_t purpose, const char *resource,
if (directconn) {
if (fetch_fresh_first && purpose == DIR_PURPOSE_FETCH_NETWORKSTATUS &&
- strlen(resource) == HEX_DIGEST_LEN) {
+ !strcmpstart(resource,"fp/") && strlen(resource) == HEX_DIGEST_LEN+3) {
/* Try to ask the actual dirserver its opinion. */
char digest[DIGEST_LEN];
- base16_decode(digest, DIGEST_LEN, resource, HEX_DIGEST_LEN);
+ base16_decode(digest, DIGEST_LEN, resource+3, HEX_DIGEST_LEN);
ds = router_get_trusteddirserver_by_digest(digest);
+ // XXXXX NM remove this.
+ log_fn(LOG_NOTICE, "Going straight to the authority for %s? %s",resource,
+ ds? "Ok.":"Oops. I can't.");
}
if (!ds && fetch_fresh_first) {
/* only ask authdirservers, and don't ask myself */
@@ -450,6 +453,7 @@ directory_send_command(connection_t *conn, const char *platform,
httpcommand = "GET";//XXXX
len = strlen(resource)+32;
url = tor_malloc(len);
+ log_fn(LOG_NOTICE, "Asking for %s", resource);
tor_snprintf(url, len, "/tor/status/%s", resource);
break;
case DIR_PURPOSE_FETCH_SERVERDESC:
@@ -884,7 +888,7 @@ connection_dir_client_reached_eof(connection_t *conn)
if (conn->purpose == DIR_PURPOSE_FETCH_NETWORKSTATUS) {
/* XXXX NM We *must* make certain we get the one(s) we asked for or we
* could be partitioned. */
- log_fn(LOG_INFO,"Received networkstatus objects (size %d)",(int) body_len);
+ log_fn(LOG_INFO,"Received networkstatus objects (size %d) from server '%s'",(int) body_len, conn->address);
if (status_code != 200) {
log_fn(LOG_WARN,"Received http status code %d (\"%s\") from server '%s'. Failing.",
status_code, reason, conn->address);
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index b9b590c6db..62a61d4a90 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -896,7 +896,8 @@ networkstatus_free(networkstatus_t *ns)
{
tor_free(ns->source_address);
tor_free(ns->contact);
- crypto_free_pk_env(ns->signing_key);
+ if (ns->signing_key)
+ crypto_free_pk_env(ns->signing_key);
tor_free(ns->client_versions);
tor_free(ns->server_versions);
if (ns->entries) {
@@ -1207,6 +1208,8 @@ router_set_networkstatus(const char *s, time_t arrived_at, int is_cached)
time_t now;
char fp[HEX_DIGEST_LEN+1];
+ log_fn(LOG_NOTICE, "setting status (%d)", is_cached);
+
ns = networkstatus_parse_from_string(s);
if (!ns) {
log_fn(LOG_WARN, "Couldn't parse network status.");
@@ -1330,12 +1333,13 @@ update_networkstatus_downloads(void)
/* XXXX NM This could compress multiple downloads into a single request.
* It could also be smarter on failures. */
for (i = most_recent_idx+1; needed; ++i) {
- char resource[HEX_DIGEST_LEN+1];
+ char resource[HEX_DIGEST_LEN+4];
trusted_dir_server_t *ds;
if (i >= n_dirservers)
i = 0;
ds = smartlist_get(trusted_dir_servers, i);
- base16_encode(resource, sizeof(resource), ds->digest, DIGEST_LEN);
+ strlcpy(resource, "fp/", sizeof(resource));
+ base16_encode(resource+3, sizeof(resource)-3, ds->digest, DIGEST_LEN);
directory_get_from_dirserver(DIR_PURPOSE_FETCH_NETWORKSTATUS, resource, 1);
--needed;
}
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index c514d86e23..78dfe2bf38 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -1212,7 +1212,7 @@ routerstatus_parse_entry_from_string(const char **s, smartlist_t *tokens)
goto err;
}
- if (tor_inet_aton(tok->args[5], &in) != 0) {
+ if (tor_inet_aton(tok->args[5], &in) == 0) {
log_fn(LOG_WARN, "Error parsing address '%s'", tok->args[5]);
goto err;
}