aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Ransom <rransom.8774@gmail.com>2011-09-20 04:26:09 -0700
committerRobert Ransom <rransom.8774@gmail.com>2011-10-02 16:19:36 -0700
commitc5226bfe1c26d2cbcc789c1074d8d925e7c7fea1 (patch)
tree9c3398c84722c0b5c400376f6bc4c8662940b610
parentbcfc383dc94ac90895880d5c9a740df7f163b41d (diff)
downloadtor-c5226bfe1c26d2cbcc789c1074d8d925e7c7fea1.tar
tor-c5226bfe1c26d2cbcc789c1074d8d925e7c7fea1.tar.gz
Remove an HS's last_hid_serv_requests entries when a conn. attempt ends
-rw-r--r--changes/bug333511
-rw-r--r--src/or/rendclient.c30
2 files changed, 41 insertions, 0 deletions
diff --git a/changes/bug3335 b/changes/bug3335
new file mode 100644
index 000000000..7e1e89866
--- /dev/null
+++ b/changes/bug3335
@@ -0,0 +1,11 @@
+ o Major bugfixes:
+
+ - When an attempt to connect to a hidden service ends, consider
+ refetching its hidden service descriptors from each of the HSDir
+ relays responsible for them immediately. Previously, we would
+ not consider refetching the service's descriptors from each
+ HSDir for 15 minutes after the last fetch; this behaviour was
+ inconvenient if the hidden service was not running during the
+ first attempt, for example. Bugfix on 0.2.0.18-alpha; fixes bug
+ 3335.
+
diff --git a/src/or/rendclient.c b/src/or/rendclient.c
index 9088b92b9..e66b2426f 100644
--- a/src/or/rendclient.c
+++ b/src/or/rendclient.c
@@ -469,6 +469,33 @@ directory_clean_last_hid_serv_requests(void)
}
}
+/** Remove all requests related to the hidden service named
+ * <b>onion_address</b> from the history of times of requests to
+ * hidden service directories. */
+static void
+purge_hid_serv_from_last_hid_serv_requests(const char *onion_address)
+{
+ strmap_iter_t *iter;
+ strmap_t *last_hid_serv_requests = get_last_hid_serv_requests();
+ /* XXX023 tor_assert(strlen(onion_address) == REND_SERVICE_ID_LEN_BASE32); */
+ for (iter = strmap_iter_init(last_hid_serv_requests);
+ !strmap_iter_done(iter); ) {
+ const char *key;
+ void *val;
+ strmap_iter_get(iter, &key, &val);
+ /* XXX023 tor_assert(strlen(key) == LAST_HID_SERV_REQUEST_KEY_LEN); */
+ if (tor_memeq(key + LAST_HID_SERV_REQUEST_KEY_LEN -
+ REND_SERVICE_ID_LEN_BASE32,
+ onion_address,
+ REND_SERVICE_ID_LEN_BASE32)) {
+ iter = strmap_iter_next_rmv(last_hid_serv_requests, iter);
+ tor_free(val);
+ } else {
+ iter = strmap_iter_next(last_hid_serv_requests, iter);
+ }
+ }
+}
+
/** Purge the history of request times to hidden service directories,
* so that future lookups of an HS descriptor will not fail because we
* accessed all of the HSDir relays responsible for the descriptor
@@ -938,6 +965,9 @@ rend_client_note_connection_attempt_ended(const char *onion_address)
rend_intro_point_t *, ip,
ip->timed_out = 0; );
}
+
+ /* Remove the HS's entries in last_hid_serv_requests. */
+ purge_hid_serv_from_last_hid_serv_requests(onion_address);
}
/** Return a newly allocated extend_info_t* for a randomly chosen introduction