aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Ransom <rransom.8774@gmail.com>2011-04-25 06:38:35 -0700
committerSebastian Hahn <sebastian@torproject.org>2011-04-28 18:14:50 +0200
commitf1cf9bd74d225e90ca123eb664c1c5538eedaa03 (patch)
treeb188d7d9f86dfab99e6cb380a640cda918eef5b8
parent2ad18ae7366ce4979b44fa53d0105940005489c0 (diff)
downloadtor-f1cf9bd74d225e90ca123eb664c1c5538eedaa03.tar.gz
tor-f1cf9bd74d225e90ca123eb664c1c5538eedaa03.zip
Fix a bug introduced by purging rend_cache on NEWNYM
If the user sent a SIGNAL NEWNYM command after we fetched a rendezvous descriptor, while we were building the introduction-point circuit, we would give up entirely on trying to connect to the hidden service. Original patch by rransom slightly edited to go into 0.2.1
-rw-r--r--src/or/rendclient.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/src/or/rendclient.c b/src/or/rendclient.c
index ca846d9b4b..fb95efbdcb 100644
--- a/src/or/rendclient.c
+++ b/src/or/rendclient.c
@@ -74,10 +74,27 @@ rend_client_send_introduction(origin_circuit_t *introcirc,
if (rend_cache_lookup_entry(introcirc->rend_data->onion_address, -1,
&entry) < 1) {
- log_warn(LD_REND,
- "query %s didn't have valid rend desc in cache. Failing.",
- escaped_safe_str(introcirc->rend_data->onion_address));
- goto perm_err;
+ log_info(LD_REND,
+ "query %s didn't have valid rend desc in cache. "
+ "Refetching descriptor.",
+ safe_str(introcirc->rend_data->onion_address));
+ /* Fetch both v0 and v2 rend descriptors in parallel. Use whichever
+ * arrives first. Exception: When using client authorization, only
+ * fetch v2 descriptors.*/
+ rend_client_refetch_v2_renddesc(introcirc->rend_data);
+ if (introcirc->rend_data->auth_type == REND_NO_AUTH)
+ rend_client_refetch_renddesc(introcirc->rend_data->onion_address);
+ {
+ connection_t *conn;
+
+ while ((conn = connection_get_by_type_state_rendquery(CONN_TYPE_AP,
+ AP_CONN_STATE_CIRCUIT_WAIT,
+ introcirc->rend_data->onion_address, -1))) {
+ conn->state = AP_CONN_STATE_RENDDESC_WAIT;
+ }
+ }
+
+ return -1;
}
/* first 20 bytes of payload are the hash of Bob's pk */