mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
rate_limiter: Use Mutex::get_mut() in update_buckets
There is no need to lock. That function already holds a mutable reference to self. Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
@@ -486,7 +486,7 @@ impl RateLimiter {
|
||||
/// Updates the parameters of the token buckets associated with this RateLimiter.
|
||||
// TODO: Please note that, right now, the buckets become full after being updated.
|
||||
pub fn update_buckets(&mut self, bytes: BucketUpdate, ops: BucketUpdate) {
|
||||
let mut guard = self.inner.lock().unwrap();
|
||||
let guard = self.inner.get_mut().unwrap();
|
||||
match bytes {
|
||||
BucketUpdate::Disabled => guard.bandwidth = None,
|
||||
BucketUpdate::Update(tb) => guard.bandwidth = Some(tb),
|
||||
|
||||
Reference in New Issue
Block a user