aboutsummaryrefslogtreecommitdiff
path: root/src/feature
diff options
context:
space:
mode:
authorteor <teor@torproject.org>2019-08-23 15:09:19 +1000
committerteor <teor@torproject.org>2019-08-23 15:09:19 +1000
commit14b5f40b54e41a2eb6cf73b2a4f42193b9f2d6d2 (patch)
treedc30a9f2e61e11a9aec63fe30019d8b5fcc1a83c /src/feature
parent5653b93a1d25e173bebb8f45d364e3a578572789 (diff)
parent231a74363fa9ccd1769b61229dc70a72e1e5807b (diff)
downloadtor-14b5f40b54e41a2eb6cf73b2a4f42193b9f2d6d2.tar.gz
tor-14b5f40b54e41a2eb6cf73b2a4f42193b9f2d6d2.zip
Merge branch 'bug23818_029' into bug23818_035
Diffstat (limited to 'src/feature')
-rw-r--r--src/feature/rend/rendservice.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/feature/rend/rendservice.c b/src/feature/rend/rendservice.c
index 5ee084b0b7..c96ecec308 100644
--- a/src/feature/rend/rendservice.c
+++ b/src/feature/rend/rendservice.c
@@ -2122,8 +2122,12 @@ rend_service_receive_introduction(origin_circuit_t *circuit,
int flags = CIRCLAUNCH_NEED_CAPACITY | CIRCLAUNCH_IS_INTERNAL;
if (circ_needs_uptime) flags |= CIRCLAUNCH_NEED_UPTIME;
/* A Single Onion Service only uses a direct connection if its
- * firewall rules permit direct connections to the address. */
- if (rend_service_use_direct_connection(options, rp)) {
+ * firewall rules permit direct connections to the address.
+ *
+ * We only use a one-hop path on the first attempt. If the first attempt
+ * fails, we use a 3-hop path for reachability / reliability.
+ * See the comment in rend_service_relauch_rendezvous() for details. */
+ if (rend_service_use_direct_connection(options, rp) && i == 0) {
flags = flags | CIRCLAUNCH_ONEHOP_TUNNEL;
}
launched = circuit_launch_by_extend_info(
@@ -3063,8 +3067,15 @@ rend_service_launch_establish_intro(rend_service_t *service,
extend_info_t *launch_ei = intro->extend_info;
extend_info_t *direct_ei = NULL;
- /* Are we in single onion mode? */
- if (rend_service_allow_non_anonymous_connection(options)) {
+ /* Are we in single onion mode?
+ *
+ * We only use a one-hop path on the first attempt. If the first attempt
+ * fails, we use a 3-hop path for reachability / reliability.
+ * (Unlike v3, retries is incremented by the caller after it calls this
+ * function.)
+ */
+ if (rend_service_allow_non_anonymous_connection(options) &&
+ intro->circuit_retries == 0) {
/* Do we have a descriptor for the node?
* We've either just chosen it from the consensus, or we've just reviewed
* our intro points to see which ones are still valid, and deleted the ones