aboutsummaryrefslogtreecommitdiff
path: root/src/or/circuitbuild.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2015-01-07 10:27:22 -0500
committerNick Mathewson <nickm@torproject.org>2015-01-07 10:27:22 -0500
commitb56c7614b64a3129df069e3ec161973073b127ef (patch)
treeccabbe702a072cfc4b2ec194d8211d06ce991904 /src/or/circuitbuild.c
parent79aaad952f4f43a7057c4162ae378d5bad28a77e (diff)
downloadtor-b56c7614b64a3129df069e3ec161973073b127ef.tar.gz
tor-b56c7614b64a3129df069e3ec161973073b127ef.zip
When closing circs build through a new guard, only close local ones
If we decide not to use a new guard because we want to retry older guards, only close the locally-originating circuits passing through that guard. Previously we would close all the circuits. Fixes bug 9819; bugfix on 0.2.1.1-alpha. Reported by "skruffy".
Diffstat (limited to 'src/or/circuitbuild.c')
-rw-r--r--src/or/circuitbuild.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index 9620a23655..e01aca959a 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -551,9 +551,13 @@ circuit_handle_first_hop(origin_circuit_t *circ)
* open and get them to send their create cells forward.
*
* Status is 1 if connect succeeded, or 0 if connect failed.
+ *
+ * Close_origin_circs is 1 if we should close all the origin circuits through
+ * this channel, or 0 otherwise. (This happens when we want to retry an
+ * older guard.)
*/
void
-circuit_n_chan_done(channel_t *chan, int status)
+circuit_n_chan_done(channel_t *chan, int status, int close_origin_circuits)
{
smartlist_t *pending_circs;
int err_reason = 0;
@@ -591,6 +595,11 @@ circuit_n_chan_done(channel_t *chan, int status)
circuit_mark_for_close(circ, END_CIRC_REASON_CHANNEL_CLOSED);
continue;
}
+ if (close_origin_circuits && CIRCUIT_IS_ORIGIN(circ)) {
+ log_info(LD_CIRC,"Channel deprecated for origin circs; closing circ.");
+ circuit_mark_for_close(circ, END_CIRC_REASON_CHANNEL_CLOSED);
+ continue;
+ }
log_debug(LD_CIRC, "Found circ, sending create cell.");
/* circuit_deliver_create_cell will set n_circ_id and add us to
* chan_circuid_circuit_map, so we don't need to call