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

svn:r9271
This commit is contained in:
Roger Dingledine 2007-01-05 06:59:36 +00:00
parent ee0d2d486d
commit 48a9fe4bbd
2 changed files with 4 additions and 5 deletions

View File

@ -1182,7 +1182,10 @@ global_write_bucket_low(size_t attempt, int priority)
return 1; /* not enough space no matter the priority */ return 1; /* not enough space no matter the priority */
if (priority == 1) { /* old-style v1 query */ 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; return 1;
} else { /* v2 query */ } else { /* v2 query */
/* no further constraints yet */ /* no further constraints yet */

View File

@ -1610,10 +1610,6 @@ directory_handle_command_get(dir_connection_t *conn, char *headers,
return 0; 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/")) { if (!strcmpstart(url,"/tor/status/")) {
/* v2 network status fetch. */ /* v2 network status fetch. */
size_t url_len = strlen(url); size_t url_len = strlen(url);