diff options
author | Nick Mathewson <nickm@torproject.org> | 2011-07-19 13:51:43 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2011-07-19 13:51:43 -0400 |
commit | e8b9815711e7cd1ef0b83153aefcc0d05e817f4e (patch) | |
tree | 70bedadab8572d9333232e51c2b835006c7cd4d1 /src/or/circuitlist.c | |
parent | 12dfb4f5d8cfb0f244b4a1ae3cc3af237a3034e7 (diff) | |
download | tor-e8b9815711e7cd1ef0b83153aefcc0d05e817f4e.tar.gz tor-e8b9815711e7cd1ef0b83153aefcc0d05e817f4e.zip |
Take a smarter approach to clearing isolation info
Back when I added this logic in 20c0581a79, the rule was that whenever
a circuit finished building, we cleared its isolation info. I did that
so that we would still use the circuit even if all the streams that
had previously led us to tentatively set its isolation info had closed.
But there were problems with that approach: We could pretty easily get
into a case where S1 had led us to launch C1 and S2 had led us to
launch C2, but when C1 finished, we cleared its isolation and attached
S2 first. Since C2 was still marked in a way that made S1
unattachable to it, we'd then launch another circuit needlessly.
So instead, we try the following approach now: when a circuit is done
building, we try to attach streams to it. If it remains unused after
we try attaching streams, then we clear its isolation info, and try
again to attach streams.
Thanks to Sebastian for helping me figure this out.
Diffstat (limited to 'src/or/circuitlist.c')
-rw-r--r-- | src/or/circuitlist.c | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/src/or/circuitlist.c b/src/or/circuitlist.c index 28a7181f26..0fefe9871e 100644 --- a/src/or/circuitlist.c +++ b/src/or/circuitlist.c @@ -210,23 +210,9 @@ circuit_set_state(circuit_t *circ, uint8_t state) /* add to waiting-circuit list. */ smartlist_add(circuits_pending_or_conns, circ); } - - circ->state = state; - - if (state == CIRCUIT_STATE_OPEN) { + if (state == CIRCUIT_STATE_OPEN) tor_assert(!circ->n_conn_onionskin); - if (CIRCUIT_IS_ORIGIN(circ)) { - origin_circuit_t *origin_circ = TO_ORIGIN_CIRCUIT(circ); - if (origin_circ->isolation_values_set && - !origin_circ->isolation_any_streams_attached) { - /* If we have any isolation information set on this circuit, - * but we never attached any streams to it, then all of the - * isolation information was hypothetical. Clear it. - */ - circuit_clear_isolation(origin_circ); - } - } - } + circ->state = state; } /** Add <b>circ</b> to the global list of circuits. This is called only from |