diff options
author | Roger Dingledine <arma@torproject.org> | 2016-03-11 10:40:31 -0500 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2016-03-11 10:40:31 -0500 |
commit | e167910fce2b83d9de3a252cdf02cabdafced14b (patch) | |
tree | 9d8beb87b0455c32c5e79dd6d3b6e9543b748086 /src/or | |
parent | 656e23171d64885c1bea95403768386ee369e949 (diff) | |
download | tor-e167910fce2b83d9de3a252cdf02cabdafced14b.tar.gz tor-e167910fce2b83d9de3a252cdf02cabdafced14b.zip |
rip out hid_serv_responsible_for_desc_id()
This simplifies relay behavior, because the relay offers the hsdir
functionality independent of whether the directory authorities have
decided this relay is suitable for clients to use yet.
Implements ticket 18332.
Diffstat (limited to 'src/or')
-rw-r--r-- | src/or/rendcache.c | 11 | ||||
-rw-r--r-- | src/or/rendcommon.c | 26 | ||||
-rw-r--r-- | src/or/rendcommon.h | 1 |
3 files changed, 1 insertions, 37 deletions
diff --git a/src/or/rendcache.c b/src/or/rendcache.c index cb8c14b756..6c22503e53 100644 --- a/src/or/rendcache.c +++ b/src/or/rendcache.c @@ -483,8 +483,7 @@ rend_cache_clean_v2_descs_as_dir(time_t now, size_t force_remove) digestmap_iter_get(iter, &key, &val); ent = val; if (ent->parsed->timestamp < cutoff || - ent->last_served < last_served_cutoff || - !hid_serv_responsible_for_desc_id(key)) { + ent->last_served < last_served_cutoff) { char key_base32[REND_DESC_ID_V2_LEN_BASE32 + 1]; base32_encode(key_base32, sizeof(key_base32), key, DIGEST_LEN); log_info(LD_REND, "Removing descriptor with ID '%s' from cache", @@ -657,14 +656,6 @@ rend_cache_store_v2_desc_as_dir(const char *desc) /* For pretty log statements. */ base32_encode(desc_id_base32, sizeof(desc_id_base32), desc_id, DIGEST_LEN); - /* Is desc ID in the range that we are (directly or indirectly) responsible - * for? */ - if (!hid_serv_responsible_for_desc_id(desc_id)) { - log_info(LD_REND, "Service descriptor with desc ID %s is not in " - "interval that we are responsible for.", - safe_str_client(desc_id_base32)); - goto skip; - } /* Is descriptor too old? */ if (parsed->timestamp < now - REND_CACHE_MAX_AGE-REND_CACHE_MAX_SKEW) { log_info(LD_REND, "Service descriptor with desc ID %s is too old.", diff --git a/src/or/rendcommon.c b/src/or/rendcommon.c index 79509cbe2f..f1fb0d934c 100644 --- a/src/or/rendcommon.c +++ b/src/or/rendcommon.c @@ -983,29 +983,3 @@ hid_serv_acting_as_directory(void) return 1; } -/** Return true if this node is responsible for storing the descriptor ID - * in <b>query</b> and false otherwise. */ -MOCK_IMPL(int, hid_serv_responsible_for_desc_id, - (const char *query)) -{ - const routerinfo_t *me; - routerstatus_t *last_rs; - const char *my_id, *last_id; - int result; - smartlist_t *responsible; - if (!hid_serv_acting_as_directory()) - return 0; - if (!(me = router_get_my_routerinfo())) - return 0; /* This is redundant, but let's be paranoid. */ - my_id = me->cache_info.identity_digest; - responsible = smartlist_new(); - if (hid_serv_get_responsible_directories(responsible, query) < 0) { - smartlist_free(responsible); - return 0; - } - last_rs = smartlist_get(responsible, smartlist_len(responsible)-1); - last_id = last_rs->identity_digest; - result = rend_id_is_in_interval(my_id, query, last_id); - smartlist_free(responsible); - return result; -} diff --git a/src/or/rendcommon.h b/src/or/rendcommon.h index fe45299598..b3ae790518 100644 --- a/src/or/rendcommon.h +++ b/src/or/rendcommon.h @@ -60,7 +60,6 @@ void rend_get_descriptor_id_bytes(char *descriptor_id_out, int hid_serv_get_responsible_directories(smartlist_t *responsible_dirs, const char *id); int hid_serv_acting_as_directory(void); -MOCK_DECL(int, hid_serv_responsible_for_desc_id, (const char *id)); rend_data_t *rend_data_dup(const rend_data_t *data); rend_data_t *rend_data_client_create(const char *onion_address, |