Browse Source

be a bit less eager to reject v1 dir requests due to load

svn:r9271
Roger Dingledine 17 years ago
parent
commit
48a9fe4bbd
2 changed files with 4 additions and 5 deletions
  1. 4 1
      src/or/connection.c
  2. 0 4
      src/or/directory.c

+ 4 - 1
src/or/connection.c

@@ -1182,7 +1182,10 @@ global_write_bucket_low(size_t attempt, int priority)
     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 */

+ 0 - 4
src/or/directory.c

@@ -1610,10 +1610,6 @@ directory_handle_command_get(dir_connection_t *conn, char *headers,
     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);