summaryrefslogtreecommitdiff
path: root/src/or/rendcache.h
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@ev0ke.net>2015-06-18 16:09:18 -0400
committerNick Mathewson <nickm@torproject.org>2015-08-11 09:34:41 -0400
commitab9a0e340728abd96128da726f67b4ccca10ba52 (patch)
treef3db7383a0733814acd15a1bf503ed2948afa096 /src/or/rendcache.h
parent9338847bf427b59d6dd5634fc2f8998ce0e269c1 (diff)
downloadtor-ab9a0e340728abd96128da726f67b4ccca10ba52.tar.gz
tor-ab9a0e340728abd96128da726f67b4ccca10ba52.zip
Add rend failure cache
When fetching a descriptor, we know test every introduction points in it against our rend failure cache to know if we keep it or not. For this to work, now everytime an introduction points is discareded (ex: receiving a NACK), we note it down in our introduction cache. See rendcache.c for a detailed explanation of the cache's behavior. Fixes #16389 Signed-off-by: David Goulet <dgoulet@ev0ke.net>
Diffstat (limited to 'src/or/rendcache.h')
-rw-r--r--src/or/rendcache.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/or/rendcache.h b/src/or/rendcache.h
index f61f02a8e6..21be9f908b 100644
--- a/src/or/rendcache.h
+++ b/src/or/rendcache.h
@@ -10,6 +10,7 @@
#define TOR_RENDCACHE_H
#include "or.h"
+#include "rendcommon.h"
/** How old do we let hidden service descriptors get before discarding
* them as too old? */
@@ -31,6 +32,17 @@ typedef struct rend_cache_entry_t {
rend_service_descriptor_t *parsed; /**< Parsed value of 'desc' */
} rend_cache_entry_t;
+/* Introduction point failure type. */
+typedef struct rend_cache_failure_intro_t {
+ unsigned int failure_type;
+} rend_cache_failure_intro_t;
+
+/** Cache failure object indexed by service ID. */
+typedef struct rend_cache_failure_t {
+ /* Contains rend_cache_failure_intro_t indexed by identity digest. */
+ digestmap_t *intro_failures;
+} rend_cache_failure_t;
+
void rend_cache_init(void);
void rend_cache_clean(time_t now);
void rend_cache_clean_v2_descs_as_dir(time_t now, size_t min_to_remove);
@@ -53,5 +65,9 @@ rend_cache_store_status_t rend_cache_store_v2_desc_as_client(const char *desc,
rend_cache_entry_t **entry);
size_t rend_cache_get_total_allocation(void);
+void rend_cache_intro_failure_note(unsigned int failure,
+ const uint8_t *identity,
+ const char *service_id);
+
#endif /* TOR_RENDCACHE_H */