[or-cvs] r9281: Fix computation of total_exit_bandwidth; this will cause exi (in tor/trunk: . src/or)

nickm at seul.org nickm at seul.org
Sat Jan 6 06:27:10 UTC 2007


Author: nickm
Date: 2007-01-06 01:26:53 -0500 (Sat, 06 Jan 2007)
New Revision: 9281

Modified:
   tor/trunk/
   tor/trunk/ChangeLog
   tor/trunk/src/or/dirserv.c
Log:
 r11863 at Kushana:  nickm | 2007-01-06 01:12:24 -0500
 Fix computation of total_exit_bandwidth; this will cause exits not to get recommended as guards if the total exit bandwidth if they constitute less than a third of total available bandwidth.  There may be problems here with flapping; lets see if they occur in practice.



Property changes on: tor/trunk
___________________________________________________________________
 svk:merge ticket from /tor/trunk [r11863] on c95137ef-5f19-0410-b913-86e773d04f59

Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog	2007-01-06 06:26:46 UTC (rev 9280)
+++ tor/trunk/ChangeLog	2007-01-06 06:26:53 UTC (rev 9281)
@@ -20,6 +20,10 @@
       server status events so controllers can learn about Tor's progress in
       deciding whether it's reachable from the outside.
 
+  o Minor features (directory):
+    - Authorities do not recommend exits as guards if this would shift
+      excess load to the exit nodes.
+
   o Minor bugfixes:
     - Restore a warning message if we accidentally resolve an address that
       we weren't planning to resolve.

Modified: tor/trunk/src/or/dirserv.c
===================================================================
--- tor/trunk/src/or/dirserv.c	2007-01-06 06:26:46 UTC (rev 9280)
+++ tor/trunk/src/or/dirserv.c	2007-01-06 06:26:53 UTC (rev 9281)
@@ -1337,7 +1337,8 @@
  * servers to stable_uptime, and the relative bandwidth capacities to
  * fast_bandwidth and guard_bandwidth.  Set total_bandwidth to the total
  * capacity of all running valid servers and total_exit_bandwidth to the
- * capacity of all running valid exits. */
+ * capacity of all running valid exits.  Set the is_exit flag of each router
+ * appropriately. */
 static void
 dirserv_compute_performance_thresholds(routerlist_t *rl)
 {
@@ -1354,20 +1355,14 @@
     if (ri->is_running && ri->is_valid) {
       uint32_t *up = tor_malloc(sizeof(uint32_t));
       uint32_t *bw = tor_malloc(sizeof(uint32_t));
+      ri->is_exit = exit_policy_is_general_exit(ri->exit_policy);
       *up = (uint32_t) real_uptime(ri, now);
       smartlist_add(uptimes, up);
       *bw = router_get_advertised_bandwidth(ri);
       total_bandwidth += *bw;
-      total_exit_bandwidth += *bw;
-      /* XXX012 The above line doesn't actually count exit bandwidth. */
-      /* While we're at it, we might want to avoid BadExit nodes when
-       * counting exit bandwidth. */
-      /* Also, we might want to document the one-third behavior in
-       * dir-spec.txt. */
-/* ChangeLog line when we reenable it:
-    - Authorities do not recommend exits as guards if this would shift
-      excess load to the exit nodes.
-*/
+      if (ri->is_exit && !ri->is_bad_exit)
+        total_exit_bandwidth += *bw;
+      /* XXXX012 Document the one-third behavior in dir-spec.txt. */
       smartlist_add(bandwidths, bw);
     }
   });
@@ -1508,7 +1503,8 @@
 
   SMARTLIST_FOREACH(rl->routers, routerinfo_t *, ri, {
     if (ri->cache_info.published_on >= cutoff) {
-      int f_exit = exit_policy_is_general_exit(ri->exit_policy);
+      /* Already set by compute_performance_thresholds. */
+      int f_exit = ri->is_exit;
       /* These versions dump connections with idle live circuits
          sometimes. D'oh!*/
       int unstable_version =



More information about the tor-commits mailing list