summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2005-09-09 19:37:12 +0000
committerNick Mathewson <nickm@torproject.org>2005-09-09 19:37:12 +0000
commit0de64f224e938cbe7f4b4d7c1f116472169af5f6 (patch)
tree8a083227592387d7d63d45426de2b1b60ed881b9
parent42f752a0a5019d1bcf1cb935a4585561fbf268db (diff)
downloadtor-0de64f224e938cbe7f4b4d7c1f116472169af5f6.tar.gz
tor-0de64f224e938cbe7f4b4d7c1f116472169af5f6.zip
Warn in more detail when network-status serving and fetching fails. Also, fix a small leak.
svn:r4963
-rw-r--r--src/or/directory.c5
-rw-r--r--src/or/dirserv.c24
2 files changed, 22 insertions, 7 deletions
diff --git a/src/or/directory.c b/src/or/directory.c
index ed6eeb05d5..e125a40fe6 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -892,8 +892,9 @@ connection_dir_client_reached_eof(connection_t *conn)
char *cp;
log_fn(LOG_INFO,"Received networkstatus objects (size %d) from server '%s:%d'",(int) body_len, conn->address, conn->port);
if (status_code != 200) {
- log_fn(LOG_WARN,"Received http status code %d (\"%s\") from server '%s:%d'. I'll try again soon.",
- status_code, reason, conn->address, conn->port);
+ log_fn(LOG_WARN,"Received http status code %d (\"%s\") from server '%s:%d' while fetching \"/tor/status/%s\". I'll try again soon.",
+ status_code, reason, conn->address, conn->port,
+ conn->requested_resource);
tor_free(body); tor_free(headers); tor_free(reason);
return -1;
}
diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index b062514c24..f457574b15 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -1028,7 +1028,7 @@ generate_v2_networkstatus(void)
if (crypto_pk_get_fingerprint(private_key, fingerprint, 0)<0) {
log_fn(LOG_ERR, "Error computing fingerprint");
- return -1;
+ goto done;
}
contact = get_options()->ContactInfo;
@@ -1084,11 +1084,15 @@ generate_v2_networkstatus(void)
format_iso_time(published, ri->published_on);
if (base64_encode(identity64, sizeof(identity64),
- ri->identity_digest, DIGEST_LEN)<0)
+ ri->identity_digest, DIGEST_LEN)<0) {
+ log_fn(LOG_WARN, "Unable to encode router identity digest.");
goto done;
+ }
if (base64_encode(digest64, sizeof(digest64),
- ri->signed_descriptor_digest, DIGEST_LEN)<0)
+ ri->signed_descriptor_digest, DIGEST_LEN)<0) {
+ log_fn(LOG_WARN, "Unable to encode router descriptor digest.");
goto done;
+ }
identity64[BASE64_DIGEST_LEN] = '\0';
digest64[BASE64_DIGEST_LEN] = '\0';
@@ -1128,8 +1132,10 @@ generate_v2_networkstatus(void)
goto done;
}
- if (router_append_dirobj_signature(outp,endp-outp,digest,private_key)<0)
+ if (router_append_dirobj_signature(outp,endp-outp,digest,private_key)<0) {
+ log_fn(LOG_WARN, "Unable to sign router status.");
goto done;
+ }
set_cached_dir(&the_v2_networkstatus, status, time(NULL));
status = NULL; /* So it doesn't get double-freed. */
@@ -1172,6 +1178,7 @@ dirserv_get_networkstatus_v2(smartlist_t *result,
the_v2_networkstatus_is_dirty,
generate_v2_networkstatus,
"network status list", 0);
+ log_fn(LOG_WARN, "Unable to generate an authoritative network stautus.");
if (d)
smartlist_add(result, d);
}
@@ -1184,6 +1191,8 @@ dirserv_get_networkstatus_v2(smartlist_t *result,
smartlist_add(result, val);
iter = strmap_iter_next(cached_v2_networkstatus, iter);
}
+ if (smartlist_len(result) == 0)
+ log_fn(LOG_WARN, "Client requested 'all' network status objects; we have none.");
} else if (!strcmpstart(key, "fp/")) {
smartlist_t *hexdigests = smartlist_create();
smartlist_split_string(hexdigests, key+3, "+", 0, 0);
@@ -1197,9 +1206,14 @@ dirserv_get_networkstatus_v2(smartlist_t *result,
the_v2_networkstatus_is_dirty + DIR_REGEN_SLACK_TIME < time(NULL))
generate_v2_networkstatus();
cached = strmap_get(cached_v2_networkstatus, cp);
- if (cached)
+ if (cached) {
smartlist_add(result, cached);
+ } else {
+ log_fn(LOG_WARN, "Don't know about any network status with fingerprint '%s'", cp);
+ }
+ tor_free(cp);
});
+ smartlist_free(hexdigests);
}
return 0;
}