[tor-commits] [tor/master] Merge remote-tracking branch 'origin/maint-0.2.3'

nickm at torproject.org nickm at torproject.org
Tue Sep 18 20:23:14 UTC 2012


commit 920c76a2fcc843bc58b79195414d3ed4b693e76e
Merge: f675e0a aca325e
Author: Nick Mathewson <nickm at torproject.org>
Date:   Tue Sep 18 16:20:01 2012 -0400

    Merge remote-tracking branch 'origin/maint-0.2.3'

 changes/bug6866       |    4 ++++
 src/or/circuitbuild.c |   40 ++++++++++++++++++++++++++++++++++++----
 2 files changed, 40 insertions(+), 4 deletions(-)

diff --cc src/or/circuitbuild.c
index 515312f,ffc7b5e..840031d
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@@ -2648,17 -2645,25 +2648,33 @@@ pathbias_count_first_hop(origin_circuit
      RATELIM_INIT(FIRST_HOP_NOTICE_INTERVAL);
    char *rate_msg = NULL;
  
 +  /* We can't do path bias accounting without entry guards.
 +   * Testing and controller circuits also have no guards. */
 +  if (get_options()->UseEntryGuards == 0 ||
 +          circ->_base.purpose == CIRCUIT_PURPOSE_TESTING ||
 +          circ->_base.purpose == CIRCUIT_PURPOSE_CONTROLLER) {
 +    return 0;
 +  }
 +
    /* Completely ignore one hop circuits */
-   if (circ->build_state->onehop_tunnel) {
-     tor_assert(circ->build_state->desired_path_len == 1);
+   if (circ->build_state->onehop_tunnel ||
+       circ->build_state->desired_path_len == 1) {
+     /* Check for inconsistency */
+     if (circ->build_state->desired_path_len != 1 ||
+         !circ->build_state->onehop_tunnel) {
+       if ((rate_msg = rate_limit_log(&first_hop_notice_limit,
+               approx_time()))) {
+         log_info(LD_BUG,
+                "One-hop circuit has length %d. Path state is %s. "
+                "Circuit is a %s currently %s. %s",
+                circ->build_state->desired_path_len,
+                pathbias_state_to_string(circ->path_state),
+                circuit_purpose_to_string(circ->_base.purpose),
+                circuit_state_to_string(circ->_base.state),
+                rate_msg);
+       }
+       tor_fragile_assert();
+     }
      return 0;
    }
  
@@@ -2750,17 -2755,25 +2766,33 @@@ pathbias_count_success(origin_circuit_
      RATELIM_INIT(SUCCESS_NOTICE_INTERVAL);
    char *rate_msg = NULL;
  
 +  /* We can't do path bias accounting without entry guards.
 +   * Testing and controller circuits also have no guards. */
 +  if (get_options()->UseEntryGuards == 0 ||
 +          circ->_base.purpose == CIRCUIT_PURPOSE_TESTING ||
 +          circ->_base.purpose == CIRCUIT_PURPOSE_CONTROLLER) {
 +    return;
 +  }
 +
    /* Ignore one hop circuits */
-   if (circ->build_state->onehop_tunnel) {
-     tor_assert(circ->build_state->desired_path_len == 1);
+   if (circ->build_state->onehop_tunnel ||
+       circ->build_state->desired_path_len == 1) {
+     /* Check for consistency */
+     if (circ->build_state->desired_path_len != 1 ||
+         !circ->build_state->onehop_tunnel) {
+       if ((rate_msg = rate_limit_log(&success_notice_limit,
+               approx_time()))) {
+         log_info(LD_BUG,
+                "One-hop circuit has length %d. Path state is %s. "
+                "Circuit is a %s currently %s. %s",
+                circ->build_state->desired_path_len,
+                pathbias_state_to_string(circ->path_state),
+                circuit_purpose_to_string(circ->_base.purpose),
+                circuit_state_to_string(circ->_base.state),
+                rate_msg);
+       }
+       tor_fragile_assert();
+     }
      return;
    }
  





More information about the tor-commits mailing list