]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Revert "Backport fix for bug 997."
authorKarsten Loesing <karsten.loesing@gmx.net>
Fri, 19 Jun 2009 13:46:13 +0000 (15:46 +0200)
committerKarsten Loesing <karsten.loesing@gmx.net>
Fri, 19 Jun 2009 13:46:13 +0000 (15:46 +0200)
This reverts commit 3847f54945933a11d14053b80427f268ffcfd8ad.

ChangeLog
src/or/connection_edge.c
src/or/rendclient.c
src/or/rendcommon.c

index f2da854be82e8f5adadb1db5af7bea84c7ac99b4..4f72328fd17a9b715a6c416f9c1b1a156780f3ec 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -29,14 +29,6 @@ Changes in version 0.2.1.16-?? - 2009-??-??
     - Avoid crashing when we have a policy specified in a DirPolicy or
       SocksPolicy or ReachableAddresses option with ports set on it, and we
       re-load the policy.  May fix bug 996.
-    - Hidden service clients didn't use a cached service descriptor that
-      was older than 15 minutes, but wouldn't fetch a new one either. Now,
-      use a cached descriptor no matter how old it is and only fetch a new
-      one when all introduction points fail. Fix for bug 997. Patch from
-      Marcus Griep.
-    - Fix refetching of hidden service descriptors when all introduction
-      points have turned out to not work. Fixes more of bug 997.
-
 
   o Minor bugfixes (on 0.2.1.x):
     - When switching back and forth between bridge mode, do not start
index 83a7543c398618f18959a0685c2352453e55d26a..9b1f737917343f637c652f438c46570703e025d2 100644 (file)
@@ -1683,12 +1683,27 @@ connection_ap_handshake_rewrite_and_attach(edge_connection_t *conn,
       if (conn->rend_data->auth_type == REND_NO_AUTH)
         rend_client_refetch_renddesc(conn->rend_data->onion_address);
     } else { /* r > 0 */
-      conn->_base.state = AP_CONN_STATE_CIRCUIT_WAIT;
-      log_info(LD_REND, "Descriptor is here and fresh enough. Great.");
-      if (connection_ap_handshake_attach_circuit(conn) < 0) {
-        if (!conn->_base.marked_for_close)
-          connection_mark_unattached_ap(conn, END_STREAM_REASON_CANT_ATTACH);
-        return -1;
+/** How long after we receive a hidden service descriptor do we consider
+ * it valid? */
+#define NUM_SECONDS_BEFORE_HS_REFETCH (60*15)
+      if (now - entry->received < NUM_SECONDS_BEFORE_HS_REFETCH) {
+        conn->_base.state = AP_CONN_STATE_CIRCUIT_WAIT;
+        log_info(LD_REND, "Descriptor is here and fresh enough. Great.");
+        if (connection_ap_handshake_attach_circuit(conn) < 0) {
+          if (!conn->_base.marked_for_close)
+            connection_mark_unattached_ap(conn, END_STREAM_REASON_CANT_ATTACH);
+          return -1;
+        }
+      } else {
+        conn->_base.state = AP_CONN_STATE_RENDDESC_WAIT;
+        log_info(LD_REND, "Stale descriptor %s. Re-fetching.",
+                 safe_str(conn->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(conn->rend_data);
+        if (conn->rend_data->auth_type == REND_NO_AUTH)
+          rend_client_refetch_renddesc(conn->rend_data->onion_address);
       }
     }
     return 0;
index 1103014fa739a81e4025712ae02dbfcf27de45a3..784db9dadf09b188eb4a3b72df21cd3c74a3ec03 100644 (file)
@@ -473,9 +473,10 @@ rend_client_refetch_renddesc(const char *query)
   }
 }
 
-/** Unless we already have a descriptor for <b>rend_query</b> with at least
- * one (possibly) working introduction point in it, start a connection to a
- * hidden service directory to fetch a v2 rendezvous service descriptor. */
+/** Start a connection to a hidden service directory to fetch a v2
+ * rendezvous service descriptor for the base32-encoded service ID
+ * <b>query</b>.
+ */
 void
 rend_client_refetch_v2_renddesc(const rend_data_t *rend_query)
 {
index 4d7b6381afac5f3cb9cc4b45eaf25c93251cca44..d21eb42efede20f84160fa2e5e9f7053235041a7 100644 (file)
@@ -966,11 +966,6 @@ rend_cache_lookup_entry(const char *query, int version, rend_cache_entry_t **e)
   }
   if (!*e)
     return 0;
-  tor_assert((*e)->parsed && (*e)->parsed->intro_nodes);
-  /* XXX022 hack for now, to return "not found" if there are no intro
-   * points remaining. See bug 997. */
-  if (smartlist_len((*e)->parsed->intro_nodes) == 0)
-    return 0;
   return 1;
 }