[or-cvs] r9366: break out the big guns: reject dir requests much more aggres (tor/trunk/src/or)
arma at seul.org
arma at seul.org
Wed Jan 17 01:29:55 UTC 2007
Author: arma
Date: 2007-01-16 20:29:54 -0500 (Tue, 16 Jan 2007)
New Revision: 9366
Modified:
tor/trunk/src/or/connection.c
Log:
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.
Modified: tor/trunk/src/or/connection.c
===================================================================
--- tor/trunk/src/or/connection.c 2007-01-17 00:14:43 UTC (rev 9365)
+++ tor/trunk/src/or/connection.c 2007-01-17 01:29:54 UTC (rev 9366)
@@ -1099,6 +1099,8 @@
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 @@
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 @@
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;
More information about the tor-commits
mailing list