summaryrefslogtreecommitdiff
path: root/src/or/rendcommon.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2005-01-19 23:15:59 +0000
committerRoger Dingledine <arma@torproject.org>2005-01-19 23:15:59 +0000
commit38be533c69417aacf28cedec1c3bae808ce29f48 (patch)
tree4b32df1d9146b1a598dc0956f29e107092308da8 /src/or/rendcommon.c
parentff48179372853bc7625981503c58a06cd509462a (diff)
downloadtor-38be533c69417aacf28cedec1c3bae808ce29f48.tar.gz
tor-38be533c69417aacf28cedec1c3bae808ce29f48.zip
Handle unavailable hidden services better. We try each intro point
until none are left, then we try to refetch the descriptor. If it's the same one we had before, then close streams right then. Whenever a new stream arrives, even if it's right after, optimistically try refetching the descriptor, just in case. svn:r3379
Diffstat (limited to 'src/or/rendcommon.c')
-rw-r--r--src/or/rendcommon.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/or/rendcommon.c b/src/or/rendcommon.c
index 7b47667bc5..090b803785 100644
--- a/src/or/rendcommon.c
+++ b/src/or/rendcommon.c
@@ -242,7 +242,9 @@ int rend_cache_lookup_desc(const char *query, const char **desc, size_t *desc_le
/** Parse *desc, calculate its service id, and store it in the cache.
* If we have a newer descriptor with the same ID, ignore this one.
* If we have an older descriptor with the same ID, replace it.
- * Returns -1 if it's malformed or otherwise rejected, else return 0.
+ * 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.
*/
int rend_cache_store(const char *desc, size_t desc_len)
{
@@ -250,6 +252,7 @@ int rend_cache_store(const char *desc, size_t desc_len)
rend_service_descriptor_t *parsed;
char query[REND_SERVICE_ID_LEN+1];
time_t now;
+
tor_assert(rend_cache);
parsed = rend_parse_service_descriptor(desc,desc_len);
if (!parsed) {
@@ -298,7 +301,7 @@ int rend_cache_store(const char *desc, size_t desc_len)
memcpy(e->desc, desc, desc_len);
log_fn(LOG_INFO,"Successfully stored rend desc '%s', len %d", query, (int)desc_len);
- return 0;
+ return 1;
}
/** Called when we get a rendezvous-related relay cell on circuit