[tor-commits] [tor/release-0.2.2] clarify an assert

arma at torproject.org arma at torproject.org
Tue Mar 8 21:13:26 UTC 2011


commit 5a4f7fa1e48923730376c0a42121e4c3022eef3b
Author: Sebastian Hahn <sebastian at torproject.org>
Date:   Sat Feb 26 09:42:44 2011 +0100

    clarify an assert
    
    also log about running changes, even on a bridge authority.
---
 src/or/rephist.c |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/src/or/rephist.c b/src/or/rephist.c
index 7c570e2..207eb88 100644
--- a/src/or/rephist.c
+++ b/src/or/rephist.c
@@ -307,6 +307,7 @@ rep_hist_note_router_reachable(const char *id, const tor_addr_t *at_addr,
   int addr_changed, port_changed;
 
   tor_assert(hist);
+  tor_assert((!at_addr && !at_port) || (at_addr && at_port));
 
   addr_changed = at_addr &&
     tor_addr_compare(at_addr, &hist->last_reached_addr, CMP_EXACT) != 0;
@@ -335,7 +336,6 @@ rep_hist_note_router_reachable(const char *id, const tor_addr_t *at_addr,
      * downtime. */
     int penalty = get_options()->TestingTorNetwork ? 240 : 3600;
     networkstatus_t *ns;
-    tor_assert(at_addr);
 
     if ((ns = networkstatus_get_latest_consensus())) {
       int fresh_interval = (int)(ns->fresh_until - ns->valid_after);
@@ -346,11 +346,10 @@ rep_hist_note_router_reachable(const char *id, const tor_addr_t *at_addr,
       penalty = (int)(fresh_interval + live_interval) / 2;
     }
     format_local_iso_time(tbuf, hist->start_of_run);
-    if (!authdir_mode_bridge(get_options()))
-      log_info(LD_HIST,"Router %s still seems Running, but its address appears "
-               "to have changed since the last time it was reachable.  I'm "
-               "going to treat it as having been down for %d seconds",
-               hex_str(id, DIGEST_LEN), penalty);
+    log_info(LD_HIST,"Router %s still seems Running, but its address appears "
+             "to have changed since the last time it was reachable.  I'm "
+             "going to treat it as having been down for %d seconds",
+             hex_str(id, DIGEST_LEN), penalty);
     rep_hist_note_router_unreachable(id, when-penalty);
     rep_hist_note_router_reachable(id, NULL, 0, when);
   } else {





More information about the tor-commits mailing list