aboutsummaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
authorRobert Ransom <rransom.8774@gmail.com>2011-06-02 02:46:04 -0700
committerRobert Ransom <rransom.8774@gmail.com>2011-06-02 02:52:40 -0700
commitb0e7925c0205a68d730025cc8832110c1675cfd7 (patch)
tree9e78e3053b06ad02067d8fcf185a8a75d0f0ed9a /src/or
parenta1d866edc9af82c2134590f7ee3c4e18156a655c (diff)
downloadtor-b0e7925c0205a68d730025cc8832110c1675cfd7.tar
tor-b0e7925c0205a68d730025cc8832110c1675cfd7.tar.gz
Clear last_hid_serv_requests on SIGNAL NEWNYM
Fixes bug #3309.
Diffstat (limited to 'src/or')
-rw-r--r--src/or/main.c1
-rw-r--r--src/or/rendclient.c19
-rw-r--r--src/or/rendclient.h1
3 files changed, 21 insertions, 0 deletions
diff --git a/src/or/main.c b/src/or/main.c
index adbde9044..3c84ddaa6 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -855,6 +855,7 @@ signewnym_impl(time_t now)
addressmap_clear_transient();
rend_cache_purge();
rend_client_cancel_descriptor_fetches();
+ rend_client_purge_last_hid_serv_requests();
time_of_last_signewnym = now;
signewnym_is_pending = 0;
}
diff --git a/src/or/rendclient.c b/src/or/rendclient.c
index ec6e3f2be..12b54df0d 100644
--- a/src/or/rendclient.c
+++ b/src/or/rendclient.c
@@ -444,6 +444,25 @@ directory_clean_last_hid_serv_requests(void)
}
}
+/** 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
+ * recently. */
+void
+rend_client_purge_last_hid_serv_requests(void)
+{
+ /* Don't create the table if it doesn't exist yet (and it may very
+ * well not exist if the user hasn't accessed any HSes)... */
+ strmap_t *old_last_hid_serv_requests = last_hid_serv_requests_;
+ /* ... and let get_last_hid_serv_requests re-create it for us if
+ * necessary. */
+ last_hid_serv_requests_ = NULL;
+
+ if (old_last_hid_serv_requests != NULL) {
+ strmap_free(old_last_hid_serv_requests, _tor_free);
+ }
+}
+
/** Determine the responsible hidden service directories for <b>desc_id</b>
* and fetch the descriptor belonging to that ID from one of them. Only
* send a request to hidden service directories that we did not try within
diff --git a/src/or/rendclient.h b/src/or/rendclient.h
index 6910c1a97..2bfc850ad 100644
--- a/src/or/rendclient.h
+++ b/src/or/rendclient.h
@@ -19,6 +19,7 @@ int rend_client_introduction_acked(origin_circuit_t *circ,
size_t request_len);
void rend_client_refetch_v2_renddesc(const rend_data_t *rend_query);
void rend_client_cancel_descriptor_fetches(void);
+void rend_client_purge_last_hid_serv_requests(void);
int rend_client_remove_intro_point(extend_info_t *failed_intro,
const rend_data_t *rend_query);
int rend_client_rendezvous_acked(origin_circuit_t *circ,