aboutsummaryrefslogtreecommitdiff
path: root/src/or/circuituse.c
diff options
context:
space:
mode:
authorMike Perry <mikeperry-git@fscked.org>2012-12-12 11:53:18 -0800
committerMike Perry <mikeperry-git@fscked.org>2013-01-08 17:28:08 -0800
commit15fdfc2993777497883df8945c1c9138bea2b33a (patch)
treed681380bd17ea8812196f13b8ea4aaf239685997 /src/or/circuituse.c
parent3458d904f62b2d97dce5fea6f85285ea34851724 (diff)
downloadtor-15fdfc2993777497883df8945c1c9138bea2b33a.tar.gz
tor-15fdfc2993777497883df8945c1c9138bea2b33a.zip
Bug 7691: Send a probe cell down certain types of circs.
In general, if we tried to use a circ for a stream, but then decided to place that stream on a different circuit, we need to probe the original circuit before deciding it was a "success". We also need to do the same for cannibalized circuits that go unused.
Diffstat (limited to 'src/or/circuituse.c')
-rw-r--r--src/or/circuituse.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/src/or/circuituse.c b/src/or/circuituse.c
index ffcebfd412..de62100919 100644
--- a/src/or/circuituse.c
+++ b/src/or/circuituse.c
@@ -493,6 +493,8 @@ circuit_expire_building(void)
cutoff = s_intro_cutoff;
else if (victim->purpose == CIRCUIT_PURPOSE_C_ESTABLISH_REND)
cutoff = stream_cutoff;
+ else if (victim->purpose == CIRCUIT_PURPOSE_PATH_BIAS_TESTING)
+ cutoff = close_cutoff;
else if (TO_ORIGIN_CIRCUIT(victim)->has_opened &&
victim->state != CIRCUIT_STATE_OPEN)
cutoff = cannibalized_cutoff;
@@ -581,6 +583,11 @@ circuit_expire_building(void)
victim->timestamp_dirty > cutoff.tv_sec)
continue;
break;
+ case CIRCUIT_PURPOSE_PATH_BIAS_TESTING:
+ /* Open path bias testing circuits are given a long
+ * time to complete the test, but not forever */
+ TO_ORIGIN_CIRCUIT(victim)->path_state = PATH_STATE_USE_FAILED;
+ break;
case CIRCUIT_PURPOSE_C_INTRODUCING:
/* We keep old introducing circuits around for
* a while in parallel, and they can end up "opened".
@@ -652,6 +659,18 @@ circuit_expire_building(void)
circuit_build_times_set_timeout(&circ_times);
}
}
+
+ if (TO_ORIGIN_CIRCUIT(victim)->has_opened &&
+ victim->purpose != CIRCUIT_PURPOSE_PATH_BIAS_TESTING) {
+ /* For path bias: we want to let these guys live for a while
+ * so we get a chance to test them. */
+ log_info(LD_CIRC,
+ "Allowing cannibalized circuit %d time to finish building as a "
+ "pathbias testing circ.",
+ TO_ORIGIN_CIRCUIT(victim)->global_identifier);
+ circuit_change_purpose(victim, CIRCUIT_PURPOSE_PATH_BIAS_TESTING);
+ continue; /* It now should have a longer timeout next time */
+ }
}
/* If this is a hidden service client circuit which is far enough
@@ -1232,18 +1251,6 @@ circuit_has_opened(origin_circuit_t *circ)
{
control_event_circuit_status(circ, CIRC_EVENT_BUILT, 0);
- /* Cannibalized circuits count as used for path bias.
- * (PURPOSE_GENERAL circs especially, since they are
- * marked dirty and often go unused after preemptive
- * building). */
- // XXX: Cannibalized now use RELAY_EARLY, which is visible
- // to taggers end-to-end! We really need to probe these instead.
- // Don't forget to remove this check once that's done!
- if (circ->has_opened &&
- circ->build_state->desired_path_len > DEFAULT_ROUTE_LEN) {
- circ->path_state = PATH_STATE_USE_SUCCEEDED;
- }
-
/* Remember that this circuit has finished building. Now if we start
* it building again later (e.g. by extending it), we will know not
* to consider its build time. */