Browse Source

Add log message checks for different rates.

May want to squash this forward or back..
Mike Perry 13 years ago
parent
commit
9bf5582e73
2 changed files with 19 additions and 4 deletions
  1. 14 3
      src/or/circuitbuild.c
  2. 5 1
      src/or/entrynodes.h

+ 14 - 3
src/or/circuitbuild.c

@@ -1408,7 +1408,8 @@ entry_guard_inc_first_hop_count(entry_guard_t *guard)
      * rate and disable the feature entirely. If refactoring, don't
      * rate and disable the feature entirely. If refactoring, don't
      * change to <= */
      * change to <= */
     if (guard->circuit_successes/((double)guard->first_hops)
     if (guard->circuit_successes/((double)guard->first_hops)
-        < pathbias_get_crit_rate(options)) {
+        < pathbias_get_crit_rate(options)
+        && !guard->path_bias_crited) {
 
 
       /* This message is currently disabled by default. */
       /* This message is currently disabled by default. */
       log_warn(LD_PROTOCOL,
       log_warn(LD_PROTOCOL,
@@ -1417,21 +1418,31 @@ entry_guard_inc_first_hop_count(entry_guard_t *guard)
                "a bug.",
                "a bug.",
                guard->circuit_successes, guard->first_hops, guard->nickname,
                guard->circuit_successes, guard->first_hops, guard->nickname,
                hex_str(guard->identity, DIGEST_LEN));
                hex_str(guard->identity, DIGEST_LEN));
+      guard->path_bias_crited = 1;
 
 
       if (pathbias_get_dropguards(options)) {
       if (pathbias_get_dropguards(options)) {
         guard->path_bias_disabled = 1;
         guard->path_bias_disabled = 1;
         guard->bad_since = approx_time();
         guard->bad_since = approx_time();
       }
       }
       return -1;
       return -1;
+    } else if (guard->circuit_successes/((double)guard->first_hops)
+               < pathbias_get_warn_rate(options)
+               && !guard->path_bias_warned) {
+      guard->path_bias_warned = 1;
+      log_notice(LD_PROTOCOL,
+                 "Low circuit success rate %u/%u for guard %s=%s.",
+                 guard->circuit_successes, guard->first_hops, guard->nickname,
+                 hex_str(guard->identity, DIGEST_LEN));
     } else if (guard->circuit_successes/((double)guard->first_hops)
     } else if (guard->circuit_successes/((double)guard->first_hops)
                < pathbias_get_notice_rate(options)
                < pathbias_get_notice_rate(options)
-               && !guard->path_bias_notice) {
-      guard->path_bias_notice = 1;
+               && !guard->path_bias_noticed) {
+      guard->path_bias_noticed = 1;
       log_notice(LD_PROTOCOL,
       log_notice(LD_PROTOCOL,
                  "Low circuit success rate %u/%u for guard %s=%s.",
                  "Low circuit success rate %u/%u for guard %s=%s.",
                  guard->circuit_successes, guard->first_hops, guard->nickname,
                  guard->circuit_successes, guard->first_hops, guard->nickname,
                  hex_str(guard->identity, DIGEST_LEN));
                  hex_str(guard->identity, DIGEST_LEN));
     }
     }
+
   }
   }
 
 
   /* If we get a ton of circuits, just scale everything down */
   /* If we get a ton of circuits, just scale everything down */

+ 5 - 1
src/or/entrynodes.h

@@ -31,7 +31,11 @@ typedef struct entry_guard_t {
                                   * router, 1 if we have. */
                                   * router, 1 if we have. */
   unsigned int can_retry : 1; /**< Should we retry connecting to this entry,
   unsigned int can_retry : 1; /**< Should we retry connecting to this entry,
                                * in spite of having it marked as unreachable?*/
                                * in spite of having it marked as unreachable?*/
-  unsigned int path_bias_notice : 1; /**< Did we alert the user about path bias
+  unsigned int path_bias_noticed : 1; /**< Did we alert the user about path bias
+                                      * for this node already? */
+  unsigned int path_bias_warned : 1; /**< Did we alert the user about path bias
+                                      * for this node already? */
+  unsigned int path_bias_crited : 1; /**< Did we alert the user about path bias
                                       * for this node already? */
                                       * for this node already? */
   unsigned int path_bias_disabled : 1; /**< Have we disabled this node because
   unsigned int path_bias_disabled : 1; /**< Have we disabled this node because
                                         * of path bias issues? */
                                         * of path bias issues? */