[tor-commits] [tor/master] Remove a needless (always-true) check.

nickm at torproject.org nickm at torproject.org
Wed Jan 31 14:47:56 UTC 2018


commit 0755bcc36ac81e4a7d569b67f5e5a2267ed47620
Author: Nick Mathewson <nickm at torproject.org>
Date:   Fri Jan 26 13:35:00 2018 -0500

    Remove a needless (always-true) check.
    
    Also add an assertion and rename a variable.
    
    Closes ticekt 24927.
---
 changes/bug24927    | 4 ++++
 src/or/circuituse.c | 7 ++++---
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/changes/bug24927 b/changes/bug24927
new file mode 100644
index 000000000..699730695
--- /dev/null
+++ b/changes/bug24927
@@ -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.
diff --git a/src/or/circuituse.c b/src/or/circuituse.c
index 1ff1de465..3a14a3ccf 100644
--- a/src/or/circuituse.c
+++ b/src/or/circuituse.c
@@ -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);
     }
   }
 





More information about the tor-commits mailing list