aboutsummaryrefslogtreecommitdiff
path: root/src/or/rendcache.c
diff options
context:
space:
mode:
authorDonncha O'Cearbhaill <donncha@donncha.is>2015-08-03 17:33:28 +0200
committerDonncha O'Cearbhaill <donncha@donncha.is>2015-09-08 12:34:05 +0200
commit5dc2cbafefa9c15fd5c96707b1e5bde0c59b6132 (patch)
tree680628ca9dfc49d8afd88931503b21ad13a8025a /src/or/rendcache.c
parent580673cf9487389a55c9c0efea54b818ec272d9c (diff)
downloadtor-5dc2cbafefa9c15fd5c96707b1e5bde0c59b6132.tar.gz
tor-5dc2cbafefa9c15fd5c96707b1e5bde0c59b6132.zip
Specify descriptor cache type in rend_cache_lookup_entry()
Adds an Enum which represents the different types of rendezvous descriptor caches. This argument is passed in each call to rend_cache_lookup_entry() to specify lookup in the client-side or service-side descriptor caches.
Diffstat (limited to 'src/or/rendcache.c')
-rw-r--r--src/or/rendcache.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/or/rendcache.c b/src/or/rendcache.c
index 1c466414c1..0abfeb50ca 100644
--- a/src/or/rendcache.c
+++ b/src/or/rendcache.c
@@ -479,7 +479,7 @@ rend_cache_clean_v2_descs_as_dir(time_t now, size_t force_remove)
* -ENOENT means that no entry in the cache was found. */
int
rend_cache_lookup_entry(const char *query, int version, rend_cache_entry_t **e,
- int service)
+ rend_cache_type_t cache)
{
int ret = 0;
char key[REND_SERVICE_ID_LEN_BASE32 + 2]; /* <version><query>\0 */
@@ -502,7 +502,7 @@ rend_cache_lookup_entry(const char *query, int version, rend_cache_entry_t **e,
case 2:
/* Default is version 2. */
default:
- if(service){
+ if(cache == REND_CACHE_TYPE_SERVICE){
entry = strmap_get_lc(rend_cache_service, query);
} else {
tor_snprintf(key, sizeof(key), "%d%s", default_version, query);
@@ -515,7 +515,7 @@ rend_cache_lookup_entry(const char *query, int version, rend_cache_entry_t **e,
goto end;
}
/* Check descriptor is parsed only if lookup is from client cache */
- if(!service){
+ if(cache == REND_CACHE_TYPE_CLIENT){
tor_assert(entry->parsed && entry->parsed->intro_nodes);
}