aboutsummaryrefslogtreecommitdiff
path: root/src/or/rendcommon.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2008-10-02 07:32:13 +0000
committerRoger Dingledine <arma@torproject.org>2008-10-02 07:32:13 +0000
commite7f5a07ff432d4db0caf2009d36766f4f448da32 (patch)
treee42fa5bc2495934be0851bf8f5196ac39453352a /src/or/rendcommon.c
parente24b812a32cd3e9281670443e6a02952315b0234 (diff)
downloadtor-e7f5a07ff432d4db0caf2009d36766f4f448da32.tar
tor-e7f5a07ff432d4db0caf2009d36766f4f448da32.tar.gz
Make rend_cache_store() use the same return error codes as its v2
equivalent: I got a lonely "Failed to fetch rendezvous descriptor." in my log file, even when the connection worked. svn:r17028
Diffstat (limited to 'src/or/rendcommon.c')
-rw-r--r--src/or/rendcommon.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/or/rendcommon.c b/src/or/rendcommon.c
index 343c43d7d..ccd52fcee 100644
--- a/src/or/rendcommon.c
+++ b/src/or/rendcommon.c
@@ -1027,9 +1027,12 @@ rend_cache_lookup_v2_desc_as_dir(const char *desc_id, const char **desc)
* If we are acting as client due to the published flag and have any v2
* descriptor with the same ID, reject this one in order to not get
* confused with having both versions for the same service.
- * Return -1 if it's malformed or otherwise rejected; return 0 if
- * it's the same or older than one we've already got; return 1 if
- * it's novel. The published flag tells us if we store the descriptor
+ *
+ * Return -2 if it's malformed or otherwise rejected; return -1 if we
+ * already have a v2 descriptor here; return 0 if it's the same or older
+ * than one we've already got; return 1 if it's novel.
+ *
+ * The published flag tells us if we store the descriptor
* in our role as directory (1) or if we cache it as client (0).
*/
int
@@ -1045,25 +1048,25 @@ rend_cache_store(const char *desc, size_t desc_len, int published)
parsed = rend_parse_service_descriptor(desc,desc_len);
if (!parsed) {
log_warn(LD_PROTOCOL,"Couldn't parse service descriptor.");
- return -1;
+ return -2;
}
if (rend_get_service_id(parsed->pk, query)<0) {
log_warn(LD_BUG,"Couldn't compute service ID.");
rend_service_descriptor_free(parsed);
- return -1;
+ return -2;
}
now = time(NULL);
if (parsed->timestamp < now-REND_CACHE_MAX_AGE-REND_CACHE_MAX_SKEW) {
log_fn(LOG_PROTOCOL_WARN, LD_REND,
"Service descriptor %s is too old.", safe_str(query));
rend_service_descriptor_free(parsed);
- return -1;
+ return -2;
}
if (parsed->timestamp > now+REND_CACHE_MAX_SKEW) {
log_fn(LOG_PROTOCOL_WARN, LD_REND,
"Service descriptor %s is too far in the future.", safe_str(query));
rend_service_descriptor_free(parsed);
- return -1;
+ return -2;
}
/* Do we have a v2 descriptor and fetched this descriptor as a client? */
tor_snprintf(key, sizeof(key), "2%s", query);