aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2008-01-24 07:33:28 +0000
committerRoger Dingledine <arma@torproject.org>2008-01-24 07:33:28 +0000
commitba7a37cf9406ac15e8f61ff7a95397893e49d50f (patch)
treeaa4b48a4d4844f249d6fb27c40d009c070b9759d /src
parent317f9e65518f5a3a9fc73a72e3fe1c2d07fd795c (diff)
downloadtor-ba7a37cf9406ac15e8f61ff7a95397893e49d50f.tar.gz
tor-ba7a37cf9406ac15e8f61ff7a95397893e49d50f.zip
shrink it even more. coding is fun!
svn:r13258
Diffstat (limited to 'src')
-rw-r--r--src/or/directory.c25
1 files changed, 7 insertions, 18 deletions
diff --git a/src/or/directory.c b/src/or/directory.c
index f5a8653d43..4242184c71 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -3315,20 +3315,15 @@ directory_get_from_hs_dir(const char *desc_id, const char *query)
tor_assert(desc_id);
tor_assert(query);
tor_assert(strlen(query) == REND_SERVICE_ID_LEN_BASE32);
- /* Determine responsible dirs. */
- if (hid_serv_get_responsible_directories(responsible_dirs, desc_id) < 0) {
- /* XXX020 make this louder once we have some v2hidservs */
- log_info(LD_REND, "Could not determine the responsible hidden service "
- "directories to fetch descriptors.");
- smartlist_free(responsible_dirs);
- return -1;
- }
+ /* Determine responsible dirs. Even if we can't get all we want,
+ * work with the ones we have. If it's empty, we'll notice below. */
+ (int) hid_serv_get_responsible_directories(responsible_dirs, desc_id);
base32_encode(desc_id_base32, sizeof(desc_id_base32),
desc_id, DIGEST_LEN);
/* Only select those hidden service directories to which we did not send
- * a request earlier. */
+ * a request recently. */
directory_clean_last_hid_serv_requests(); /* Clean request history first. */
SMARTLIST_FOREACH(responsible_dirs, routerstatus_t *, dir, {
@@ -3337,20 +3332,14 @@ directory_get_from_hs_dir(const char *desc_id, const char *query)
SMARTLIST_DEL_CURRENT(responsible_dirs, dir);
});
- if (smartlist_len(responsible_dirs) == 0) {
+ hs_dir = smartlist_choose(responsible_dirs);
+ smartlist_free(responsible_dirs);
+ if (!hs_dir) {
log_info(LD_REND, "Could not pick one of the responsible hidden "
"service directories, because we requested them all "
"recently without success.");
- smartlist_free(responsible_dirs);
return 0;
}
- hs_dir = smartlist_choose(responsible_dirs);
- smartlist_free(responsible_dirs);
- if (!hs_dir) {
- log_warn(LD_BUG, "Could not pick one of the responsible hidden service "
- "directories to fetch descriptors.");
- return -1;
- }
/* Remember, that we are requesting a descriptor from this hidden service
* directory now. */