[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r9134: a changelog for write limiting. also, disable the "advertise (in tor/trunk: . src/or)



Author: arma
Date: 2006-12-15 16:39:35 -0500 (Fri, 15 Dec 2006)
New Revision: 9134

Modified:
   tor/trunk/ChangeLog
   tor/trunk/src/or/hibernate.c
   tor/trunk/src/or/router.c
Log:
a changelog for write limiting. also, disable the "advertise dirport
until we reach our max bandwidth if it's tiny" trick now that we
do the bandwidth self-test on boot.


Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog	2006-12-15 21:27:19 UTC (rev 9133)
+++ tor/trunk/ChangeLog	2006-12-15 21:39:35 UTC (rev 9134)
@@ -4,6 +4,9 @@
       server via TLS so we do encrypted directory requests rather than
       plaintext. On by default; disable via the TunnelDirConns config
       option if you like.
+    - Enable write limiting as well as read limiting. Now we sacrifice
+      capacity if we're pushing out lots of directory traffic, rather
+      than overrunning the user's intended bandwidth limits.
 
   o Minor features:
     - Start using the state file to store bandwidth accounting data:

Modified: tor/trunk/src/or/hibernate.c
===================================================================
--- tor/trunk/src/or/hibernate.c	2006-12-15 21:27:19 UTC (rev 9133)
+++ tor/trunk/src/or/hibernate.c	2006-12-15 21:39:35 UTC (rev 9134)
@@ -716,7 +716,7 @@
 hibernate_soft_limit_reached(void)
 {
   uint64_t soft_limit = DBL_TO_U64(U64_TO_DBL(get_options()->AccountingMax)
-                                     * .95);
+                                    * .95);
   if (!soft_limit)
     return 0;
   return n_bytes_read_in_interval >= soft_limit

Modified: tor/trunk/src/or/router.c
===================================================================
--- tor/trunk/src/or/router.c	2006-12-15 21:27:19 UTC (rev 9133)
+++ tor/trunk/src/or/router.c	2006-12-15 21:39:35 UTC (rev 9134)
@@ -426,15 +426,12 @@
     return 0;
   if (!check_whether_dirport_reachable())
     return 0;
-  if (router->bandwidthcapacity >= router->bandwidthrate) {
-    /* check if we might potentially hibernate. */
-    if (options->AccountingMax != 0)
-      return 0;
-    /* also check if we're advertising a small amount, and have
-       a "boring" DirPort. */
-    if (router->bandwidthrate < 50000 && router->dir_port > 1024)
-      return 0;
-  }
+  /* check if we might potentially hibernate. */
+  if (accounting_is_enabled(options))
+    return 0;
+  /* also check if we're advertising a small amount */
+  if (router->bandwidthrate <= 51200)
+    return 0;
 
   /* Sounds like a great idea. Let's publish it. */
   return router->dir_port;