[tor-commits] [tor/master] Also shorten circuit_successes to circ_successes.

nickm at torproject.org nickm at torproject.org
Wed Dec 26 04:34:55 UTC 2012


commit ab1fce5c19b64b3f1ba15d6ffa1f0d11d6a959c3
Author: Mike Perry <mikeperry-git at fscked.org>
Date:   Sun Dec 9 20:20:44 2012 -0800

    Also shorten circuit_successes to circ_successes.
    
    For consistency and great justice.
    
    Ok, mostly consistency.
---
 src/or/circuitbuild.c |   32 ++++++++++++++++----------------
 src/or/entrynodes.c   |   10 +++++-----
 src/or/entrynodes.h   |    2 +-
 3 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index 42964eb..04b429b 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -1361,10 +1361,10 @@ pathbias_count_build_success(origin_circuit_t *circ)
     if (guard) {
       if (circ->path_state == PATH_STATE_BUILD_ATTEMPTED) {
         circ->path_state = PATH_STATE_BUILD_SUCCEEDED;
-        guard->circuit_successes++;
+        guard->circ_successes++;
 
         log_info(LD_CIRC, "Got success count %u/%u for guard %s=%s",
-                 guard->circuit_successes, guard->circ_attempts,
+                 guard->circ_successes, guard->circ_attempts,
                  guard->nickname, hex_str(guard->identity, DIGEST_LEN));
       } else {
         if ((rate_msg = rate_limit_log(&success_notice_limit,
@@ -1380,10 +1380,10 @@ pathbias_count_build_success(origin_circuit_t *circ)
         }
       }
 
-      if (guard->circ_attempts < guard->circuit_successes) {
-        log_notice(LD_BUG, "Unexpectedly high circuit_successes (%u/%u) "
+      if (guard->circ_attempts < guard->circ_successes) {
+        log_notice(LD_BUG, "Unexpectedly high successes counts (%u/%u) "
                  "for guard %s=%s",
-                 guard->circuit_successes, guard->circ_attempts,
+                 guard->circ_successes, guard->circ_attempts,
                  guard->nickname, hex_str(guard->identity, DIGEST_LEN));
       }
     /* In rare cases, CIRCUIT_PURPOSE_TESTING can get converted to
@@ -1639,7 +1639,7 @@ pathbias_get_closed_count(entry_guard_t *guard)
 
 /**
  * This function checks the consensus parameters to decide
- * if it should return guard->circuit_successes or
+ * if it should return guard->circ_successes or
  * guard->successful_circuits_closed.
  */
 static int
@@ -1648,7 +1648,7 @@ pathbias_get_success_count(entry_guard_t *guard)
   if (pathbias_use_close_counts(get_options())) {
     return pathbias_get_closed_count(guard);
   } else {
-    return guard->circuit_successes;
+    return guard->circ_successes;
   }
 }
 
@@ -1681,7 +1681,7 @@ entry_guard_inc_circ_attempt_count(entry_guard_t *guard)
                  "reference, your timeout cutoff is %ld seconds.",
                  guard->nickname, hex_str(guard->identity, DIGEST_LEN),
                  pathbias_get_closed_count(guard), guard->circ_attempts,
-                 guard->circuit_successes, guard->unusable_circuits,
+                 guard->circ_successes, guard->unusable_circuits,
                  guard->collapsed_circuits, guard->timeouts,
                  (long)circ_times.close_ms/1000);
           guard->path_bias_disabled = 1;
@@ -1699,7 +1699,7 @@ entry_guard_inc_circ_attempt_count(entry_guard_t *guard)
                  "reference, your timeout cutoff is %ld seconds.",
                  guard->nickname, hex_str(guard->identity, DIGEST_LEN),
                  pathbias_get_closed_count(guard), guard->circ_attempts,
-                 guard->circuit_successes, guard->unusable_circuits,
+                 guard->circ_successes, guard->unusable_circuits,
                  guard->collapsed_circuits, guard->timeouts,
                  (long)circ_times.close_ms/1000);
       }
@@ -1717,7 +1717,7 @@ entry_guard_inc_circ_attempt_count(entry_guard_t *guard)
                  "reference, your timeout cutoff is %ld seconds.",
                  guard->nickname, hex_str(guard->identity, DIGEST_LEN),
                  pathbias_get_closed_count(guard), guard->circ_attempts,
-                 guard->circuit_successes, guard->unusable_circuits,
+                 guard->circ_successes, guard->unusable_circuits,
                  guard->collapsed_circuits, guard->timeouts,
                  (long)circ_times.close_ms/1000);
       }
@@ -1733,7 +1733,7 @@ entry_guard_inc_circ_attempt_count(entry_guard_t *guard)
                    "reference, your timeout cutoff is %ld seconds.",
                    guard->nickname, hex_str(guard->identity, DIGEST_LEN),
                    pathbias_get_closed_count(guard), guard->circ_attempts,
-                   guard->circuit_successes, guard->unusable_circuits,
+                   guard->circ_successes, guard->unusable_circuits,
                    guard->collapsed_circuits, guard->timeouts,
                    (long)circ_times.close_ms/1000);
       }
@@ -1747,22 +1747,22 @@ entry_guard_inc_circ_attempt_count(entry_guard_t *guard)
     /* Only scale if there will be no rounding error for our scaling
      * factors */
     if (((mult_factor*guard->circ_attempts) % scale_factor) == 0 &&
-        ((mult_factor*guard->circuit_successes) % scale_factor) == 0) {
+        ((mult_factor*guard->circ_successes) % scale_factor) == 0) {
       log_info(LD_CIRC,
                "Scaling pathbias counts to (%u/%u)*(%d/%d) for guard %s=%s",
-               guard->circuit_successes, guard->circ_attempts, mult_factor,
+               guard->circ_successes, guard->circ_attempts, mult_factor,
                scale_factor, guard->nickname, hex_str(guard->identity,
                DIGEST_LEN));
 
       guard->circ_attempts *= mult_factor;
-      guard->circuit_successes *= mult_factor;
+      guard->circ_successes *= mult_factor;
       guard->timeouts *= mult_factor;
       guard->successful_circuits_closed *= mult_factor;
       guard->collapsed_circuits *= mult_factor;
       guard->unusable_circuits *= mult_factor;
 
       guard->circ_attempts /= scale_factor;
-      guard->circuit_successes /= scale_factor;
+      guard->circ_successes /= scale_factor;
       guard->timeouts /= scale_factor;
       guard->successful_circuits_closed /= scale_factor;
       guard->collapsed_circuits /= scale_factor;
@@ -1771,7 +1771,7 @@ entry_guard_inc_circ_attempt_count(entry_guard_t *guard)
   }
   guard->circ_attempts++;
   log_info(LD_CIRC, "Got success count %u/%u for guard %s=%s",
-           guard->circuit_successes, guard->circ_attempts, guard->nickname,
+           guard->circ_successes, guard->circ_attempts, guard->nickname,
            hex_str(guard->identity, DIGEST_LEN));
   return 0;
 }
diff --git a/src/or/entrynodes.c b/src/or/entrynodes.c
index 14a1e3c..84764d1 100644
--- a/src/or/entrynodes.c
+++ b/src/or/entrynodes.c
@@ -1051,7 +1051,7 @@ entry_guards_parse_state(or_state_t *state, int set, char **msg)
       }
 
       node->circ_attempts = hop_cnt;
-      node->circuit_successes = success_cnt;
+      node->circ_successes = success_cnt;
 
       node->successful_circuits_closed = successful_closed;
       node->timeouts = timeouts;
@@ -1059,17 +1059,17 @@ entry_guards_parse_state(or_state_t *state, int set, char **msg)
       node->unusable_circuits = unusable;
 
       log_info(LD_GENERAL, "Read %u/%u path bias for node %s",
-               node->circuit_successes, node->circ_attempts, node->nickname);
+               node->circ_successes, node->circ_attempts, node->nickname);
       /* Note: We rely on the < comparison here to allow us to set a 0
        * rate and disable the feature entirely. If refactoring, don't
        * change to <= */
-      if ((node->circuit_successes/((double)node->circ_attempts)
+      if ((node->circ_successes/((double)node->circ_attempts)
           < pathbias_get_extreme_rate(options)) &&
           pathbias_get_dropguards(options)) {
         node->path_bias_disabled = 1;
         log_info(LD_GENERAL,
                  "Path bias is too high (%u/%u); disabling node %s",
-                 node->circuit_successes, node->circ_attempts, node->nickname);
+                 node->circ_successes, node->circ_attempts, node->nickname);
       }
 
     } else {
@@ -1199,7 +1199,7 @@ entry_guards_update_state(or_state_t *state)
          *                                     collapsed_circuits +
          *                                     unusable_circuits */
         tor_asprintf(&line->value, "%u %u %u %u %u %u",
-                     e->circ_attempts, e->circuit_successes,
+                     e->circ_attempts, e->circ_successes,
                      pathbias_get_closed_count(e), e->collapsed_circuits,
                      e->unusable_circuits, e->timeouts);
         next = &(line->next);
diff --git a/src/or/entrynodes.h b/src/or/entrynodes.h
index b737dad..0e58802 100644
--- a/src/or/entrynodes.h
+++ b/src/or/entrynodes.h
@@ -49,7 +49,7 @@ typedef struct entry_guard_t {
                           * at which we last failed to connect to it. */
 
   unsigned circ_attempts; /**< Number of circuits this guard has "attempted" */
-  unsigned circuit_successes; /**< Number of successfully built circuits using
+  unsigned circ_successes; /**< Number of successfully built circuits using
                                * this guard as first hop. */
   unsigned successful_circuits_closed; /**< Number of circuits that carried
                                         * streams successfully. */





More information about the tor-commits mailing list