Remove a needless (always-true) check.

Also add an assertion and rename a variable.

Closes ticekt 24927.
This commit is contained in:
Nick Mathewson 2018-01-26 13:35:00 -05:00
parent 7a74b3663f
commit 0755bcc36a
2 changed files with 8 additions and 3 deletions

4
changes/bug24927 Normal file
View File

@ -0,0 +1,4 @@
o Minor bugfixes (correctness):
- Remove nonworking, unnecessary check to see whether a circuit hop's
identity was set when the circuit failed. Fixes bug 24927; bugfix on
0.2.4.4-alpha.

View File

@ -1773,7 +1773,8 @@ circuit_build_failed(origin_circuit_t *circ)
/* We failed at the first hop for some reason other than a DESTROY cell.
* If there's an OR connection to blame, blame it. Also, avoid this relay
* for a while, and fail any one-hop directory fetches destined for it. */
const char *n_chan_id = circ->cpath->extend_info->identity_digest;
const char *n_chan_ident = circ->cpath->extend_info->identity_digest;
tor_assert(n_chan_ident);
int already_marked = 0;
if (circ->base_.n_chan) {
n_chan = circ->base_.n_chan;
@ -1801,7 +1802,7 @@ circuit_build_failed(origin_circuit_t *circ)
"with no connection",
TO_CIRCUIT(circ)->n_circ_id, circ->global_identifier);
}
if (n_chan_id && !already_marked) {
if (!already_marked) {
/*
* If we have guard state (new guard API) and our path selection
* code actually chose a full path, then blame the failure of this
@ -1821,7 +1822,7 @@ circuit_build_failed(origin_circuit_t *circ)
entry_guard_failed(&circ->guard_state);
/* if there are any one-hop streams waiting on this circuit, fail
* them now so they can retry elsewhere. */
connection_ap_fail_onehop(n_chan_id, circ->build_state);
connection_ap_fail_onehop(n_chan_ident, circ->build_state);
}
}