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

[or-cvs] r9271: be a bit less eager to reject v1 dir requests due to load (tor/trunk/src/or)



Author: arma
Date: 2007-01-05 01:59:36 -0500 (Fri, 05 Jan 2007)
New Revision: 9271

Modified:
   tor/trunk/src/or/connection.c
   tor/trunk/src/or/directory.c
Log:
be a bit less eager to reject v1 dir requests due to load


Modified: tor/trunk/src/or/connection.c
===================================================================
--- tor/trunk/src/or/connection.c	2007-01-05 06:30:31 UTC (rev 9270)
+++ tor/trunk/src/or/connection.c	2007-01-05 06:59:36 UTC (rev 9271)
@@ -1182,7 +1182,10 @@
     return 1; /* not enough space no matter the priority */
 
   if (priority == 1) { /* old-style v1 query */
-    if (global_write_bucket-attempt < 2*get_options()->BandwidthRate)
+    /* Could we handle *two* of these requests within the next two seconds? */
+    /* XXX012 make this robust against overflows */
+    if (global_write_bucket + 2*(int)(get_options()->BandwidthRate) <
+        2*(int)attempt)
       return 1;
   } else { /* v2 query */
     /* no further constraints yet */

Modified: tor/trunk/src/or/directory.c
===================================================================
--- tor/trunk/src/or/directory.c	2007-01-05 06:30:31 UTC (rev 9270)
+++ tor/trunk/src/or/directory.c	2007-01-05 06:59:36 UTC (rev 9271)
@@ -1610,10 +1610,6 @@
     return 0;
   }
 
-  /* FFFF for status/ and server/ requests, we don't have a good
-   * guess of the length we're going to be writing out, so it's hard
-   * to call global_write_bucket_low(). How to proceed? */
-
   if (!strcmpstart(url,"/tor/status/")) {
     /* v2 network status fetch. */
     size_t url_len = strlen(url);