[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Fix a bug introduced by purging rend_cache on NEWNYM



commit f1cf9bd74d225e90ca123eb664c1c5538eedaa03
Author: Robert Ransom <rransom.8774@xxxxxxxxx>
Date:   Mon Apr 25 06:38:35 2011 -0700

    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
---
 src/or/rendclient.c |   25 +++++++++++++++++++++----
 1 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/src/or/rendclient.c b/src/or/rendclient.c
index ca846d9..fb95efb 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 */



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits