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

[tor-commits] [tor/master] clients use optimistic data when reaching hidden services



commit 09183dc3150000007ccc7b8fecd3b5b762a5b698
Author: Roger Dingledine <arma@xxxxxxxxxxxxxx>
Date:   Sun Sep 21 20:02:12 2014 -0400

    clients use optimistic data when reaching hidden services
    
    Allow clients to use optimistic data when connecting to a hidden service,
    which should cut out the initial round-trip for client-side programs
    including Tor Browser.
    
    (Now that Tor 0.2.2.x is obsolete, all hidden services should support
    server-side optimistic data.)
    
    See proposal 181 for details. Implements ticket 13211.
---
 changes/feature13211     |    6 ++++++
 src/or/circuituse.c      |    9 ++++++---
 src/or/connection_edge.c |    3 ++-
 3 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/changes/feature13211 b/changes/feature13211
new file mode 100644
index 0000000..dcb0196
--- /dev/null
+++ b/changes/feature13211
@@ -0,0 +1,6 @@
+  o Major features (performance):
+    - Allow clients to use optimistic data when connecting to a hidden
+      service, which should cut out the initial round-trip for client-side
+      programs including Tor Browser. (Now that Tor 0.2.2.x is obsolete,
+      all hidden services should support server-side optimistic
+      data.) See proposal 181 for details. Implements ticket 13211.
diff --git a/src/or/circuituse.c b/src/or/circuituse.c
index c1a8152..9ea0023 100644
--- a/src/or/circuituse.c
+++ b/src/or/circuituse.c
@@ -2110,14 +2110,17 @@ link_apconn_to_circ(entry_connection_t *apconn, origin_circuit_t *circ,
 
   /* See if we can use optimistic data on this circuit */
   if (optimistic_data_enabled() &&
-      circ->base_.purpose == CIRCUIT_PURPOSE_C_GENERAL)
+      (circ->base_.purpose == CIRCUIT_PURPOSE_C_GENERAL ||
+       circ->base_.purpose == CIRCUIT_PURPOSE_C_REND_JOINED))
     apconn->may_use_optimistic_data = 1;
   else
     apconn->may_use_optimistic_data = 0;
   log_info(LD_APP, "Looks like completed circuit to %s %s allow "
            "optimistic data for connection to %s",
-           /* node_describe() does the right thing if exitnode is NULL */
-           safe_str_client(node_describe(exitnode)),
+           circ->base_.purpose == CIRCUIT_PURPOSE_C_GENERAL ?
+             /* node_describe() does the right thing if exitnode is NULL */
+             safe_str_client(node_describe(exitnode)) :
+             "hidden service",
            apconn->may_use_optimistic_data ? "does" : "doesn't",
            safe_str_client(apconn->socks_request->address));
 }
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index af1b5b6..522807d 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -1767,7 +1767,8 @@ connection_ap_supports_optimistic_data(const entry_connection_t *conn)
      general circuit. */
   if (edge_conn->on_circuit == NULL ||
       edge_conn->on_circuit->state != CIRCUIT_STATE_OPEN ||
-      edge_conn->on_circuit->purpose != CIRCUIT_PURPOSE_C_GENERAL)
+      (edge_conn->on_circuit->purpose != CIRCUIT_PURPOSE_C_GENERAL &&
+       edge_conn->on_circuit->purpose != CIRCUIT_PURPOSE_C_REND_JOINED))
     return 0;
 
   return conn->may_use_optimistic_data;



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