|
@@ -3104,7 +3104,8 @@ connection_consider_empty_write_buckets(connection_t *conn)
|
|
|
connection_stop_writing(conn);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
+ * options */
|
|
|
void
|
|
|
connection_bucket_init(void)
|
|
|
{
|
|
@@ -3127,6 +3128,24 @@ connection_bucket_init(void)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+void
|
|
|
+connection_bucket_adjust(const or_options_t *options)
|
|
|
+{
|
|
|
+ token_bucket_adjust(&global_bucket,
|
|
|
+ (int32_t)options->BandwidthRate,
|
|
|
+ (int32_t)options->BandwidthBurst);
|
|
|
+ if (options->RelayBandwidthRate) {
|
|
|
+ token_bucket_adjust(&global_relayed_bucket,
|
|
|
+ (int32_t)options->RelayBandwidthRate,
|
|
|
+ (int32_t)options->RelayBandwidthBurst);
|
|
|
+ } else {
|
|
|
+ token_bucket_adjust(&global_relayed_bucket,
|
|
|
+ (int32_t)options->BandwidthRate,
|
|
|
+ (int32_t)options->BandwidthBurst);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
|
|
|
void
|
|
|
connection_bucket_refill(time_t now, uint32_t now_ts)
|