|
@@ -801,11 +801,19 @@ safe_or_connection_max_bytes_can_read(safe_or_connection_t *safe_or_conn,
|
|
|
// note: that would be a bad way to do it, since instead we should borrow
|
|
|
// some space from the global bucket, and then commit it once the read
|
|
|
// is actually finished
|
|
|
- if (use_conn_buckets) {
|
|
|
- return token_bucket_rw_get_read(&safe_or_conn->bucket);
|
|
|
- } else {
|
|
|
- return SIZE_MAX;
|
|
|
+
|
|
|
+ size_t cell_network_size = \
|
|
|
+ get_cell_network_size(safe_or_conn->wide_circ_ids?1:0);
|
|
|
+ size_t bucket_max = token_bucket_rw_get_read(&safe_or_conn->bucket);
|
|
|
+
|
|
|
+ size_t rv = 32*cell_network_size;
|
|
|
+ // this is the limit that 'connection_bucket_get_share()' uses
|
|
|
+
|
|
|
+ if (use_conn_buckets && rv > bucket_max) {
|
|
|
+ rv = bucket_max;
|
|
|
}
|
|
|
+
|
|
|
+ return rv;
|
|
|
}
|
|
|
|
|
|
static size_t
|