Don't call into the new guard algorithm when the old one is enabled.

(I'm surprised that these are the only bugs I ran into when I
tested running with the old algorithm again!)
This commit is contained in:
Nick Mathewson 2016-11-23 08:02:48 -05:00
parent d98b9b6d65
commit 8edd3d2b6c
2 changed files with 6 additions and 2 deletions

View File

@ -965,7 +965,10 @@ circuit_send_next_onion_skin(origin_circuit_t *circ)
if (!hop) { if (!hop) {
/* done building the circuit. whew. */ /* done building the circuit. whew. */
int r; int r;
if (! circ->guard_state) { if (get_options()->UseDeprecatedGuardAlgorithm) {
// The circuit is usable; we already marked the guard as okay.
r = 1;
} else if (! circ->guard_state) {
if (circuit_get_cpath_len(circ) != 1) { if (circuit_get_cpath_len(circ) != 1) {
log_warn(LD_BUG, "%d-hop circuit %p with purpose %d has no " log_warn(LD_BUG, "%d-hop circuit %p with purpose %d has no "
"guard state", "guard state",

View File

@ -1633,7 +1633,8 @@ circuit_build_failed(origin_circuit_t *circ)
"Our circuit died before the first hop with no connection"); "Our circuit died before the first hop with no connection");
} }
if (n_chan_id && !already_marked) { if (n_chan_id && !already_marked) {
entry_guard_failed(get_guard_selection_info(), &circ->guard_state); if (circ->guard_state)
entry_guard_failed(get_guard_selection_info(), &circ->guard_state);
/* XXXX prop271 -- old API */ /* XXXX prop271 -- old API */
entry_guard_register_connect_status(n_chan_id, 0, 1, time(NULL)); entry_guard_register_connect_status(n_chan_id, 0, 1, time(NULL));
/* if there are any one-hop streams waiting on this circuit, fail /* if there are any one-hop streams waiting on this circuit, fail