Skip to content
Permalink
Browse files
Don't consider a port "handled" by an isolated circuit.
Previously, circuit_stream_is_being_handled incorrectly reported
an exit port as "handled" by a circuit (meaning that the circuit
could be used by any future stream using that exit port)
regardless of whether the circuit was already isolated in some
way.

This meant that, in Tor Browser, circuit_get_unhandled_ports was
reporting that all ports were handled even though all non-internal
circuits had already been isolated by SOCKS username+password.

Therefore, circuit_predict_and_launch_new was declining to launch
new exit circuits. Then, when the user visited a new site in Tor
Browser, a stream with new SOCKS credentials would be initiated,
and the stream would have to wait while a new circuit with those
credentials could be built. That was bad for time-to-first-byte.

Now, clean, not-yet-isolated circuit(s) will be automatically
launched ahead of time and be ready for use whenever a new stream
with new SOCKS credentials (or other isolation criteria) is
initiated.

Fixes bug 18859.
  • Loading branch information
arthuredelstein committed Dec 6, 2017
1 parent 01700d7 commit e4b9f956e7c05862d6088a1b56f3e91f8326a91b
Showing with 3 additions and 1 deletion.
  1. +3 −1 src/or/circuituse.c
@@ -1001,7 +1001,7 @@ circuit_remove_handled_ports(smartlist_t *needed_ports)
tor_assert(*port);
if (circuit_stream_is_being_handled(NULL, *port,
MIN_CIRCUITS_HANDLING_STREAM)) {
// log_debug(LD_CIRC,"Port %d is already being handled; removing.", port);
log_debug(LD_CIRC,"Port %d is already being handled; removing.", *port);
smartlist_del(needed_ports, i--);
tor_free(port);
} else {
@@ -1038,6 +1038,8 @@ circuit_stream_is_being_handled(entry_connection_t *conn,
continue;
if (origin_circ->unusable_for_new_conns)
continue;
if (origin_circ->isolation_values_set)
continue;

exitnode = build_state_get_exit_node(build_state);
if (exitnode && (!need_uptime || build_state->need_uptime)) {

0 comments on commit e4b9f95

Please sign in to comment.