diff options
author | Roger Dingledine <arma@torproject.org> | 2007-01-17 01:29:54 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2007-01-17 01:29:54 +0000 |
commit | cb472fc550ec05d9df90c33399898a9f2fc3fe14 (patch) | |
tree | b8a7758668b84cc081cf4139737eee2ca9bd86f6 /src | |
parent | 8662f18102bfea591b1cf1d3b69329f9144b0620 (diff) | |
download | tor-cb472fc550ec05d9df90c33399898a9f2fc3fe14.tar.gz tor-cb472fc550ec05d9df90c33399898a9f2fc3fe14.zip |
break out the big guns: reject dir requests much more
aggressively. my vidalia bandwidth graph, when rate limiting
to 32kB/s, has the "write" line constantly at 32kB. I can't
imagine what's going on with the relay latency but it can't
be good.
svn:r9366
Diffstat (limited to 'src')
-rw-r--r-- | src/or/connection.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/or/connection.c b/src/or/connection.c index 8e4326c2c2..9d71db5d4b 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -1099,6 +1099,8 @@ retry_all_listeners(int force, smartlist_t *replaced_conns, extern int global_read_bucket, global_write_bucket; +static int global_write_bucket_empty_last_second = 0; + static int connection_bucket_round_robin(int base, int priority, int global_bucket, int conn_bucket) @@ -1184,6 +1186,9 @@ global_write_bucket_low(size_t attempt, int priority) if (global_write_bucket < (int)attempt) return 1; /* not enough space no matter the priority */ + if (global_write_bucket_empty_last_second) + return 1; /* we're already hitting our limits, no more please */ + if (priority == 1) { /* old-style v1 query */ /* Could we handle *two* of these requests within the next two seconds? */ int64_t can_write = (int64_t)global_write_bucket @@ -1279,6 +1284,7 @@ connection_bucket_refill(int seconds_elapsed) log(LOG_DEBUG, LD_NET,"global_read_bucket now %d.", global_read_bucket); } if (global_write_bucket < (int)options->BandwidthBurst) { + global_write_bucket_empty_last_second = global_write_bucket == 0; global_write_bucket += (int)options->BandwidthRate*seconds_elapsed; if (global_write_bucket > (int)options->BandwidthBurst) global_write_bucket = (int)options->BandwidthBurst; |