summaryrefslogtreecommitdiff
path: root/src/or/connection.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2006-02-11 23:15:40 +0000
committerRoger Dingledine <arma@torproject.org>2006-02-11 23:15:40 +0000
commite847085c043757dbf89b79d224c2c628ecd391ca (patch)
treea0ef70e10866fbbb0e5331dca33c8490e31af129 /src/or/connection.c
parent484a3f3d77566e83ba3ad36e2c5e79ba32e93816 (diff)
downloadtor-e847085c043757dbf89b79d224c2c628ecd391ca.tar.gz
tor-e847085c043757dbf89b79d224c2c628ecd391ca.zip
When a client asks for an old-style directory and our write bucket
is empty, don't give it to him. This way small servers can continue to serve the directory *sometimes*, without getting overloaded. svn:r5968
Diffstat (limited to 'src/or/connection.c')
-rw-r--r--src/or/connection.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/or/connection.c b/src/or/connection.c
index bb993ca43d..19f9165a7e 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -1036,6 +1036,13 @@ connection_bucket_write_limit(connection_t *conn)
return at_most;
}
+/** Return 1 if the global write bucket has no bytes in it,
+ * or return 0 if it does. */
+int global_write_bucket_empty(void)
+{
+ return global_write_bucket <= 0;
+}
+
/** We just read num_read onto conn. Decrement buckets appropriately. */
static void
connection_read_bucket_decrement(connection_t *conn, int num_read)