mirror of
https://github.com/sudosylabs/vnidrop.git
synced 2026-08-05 10:29:58 +02:00
fix(core): drop active_transfers guard before await in status
Clippy await_holding_lock failed because the sync MutexGuard lived across the active_shares.lock().await in the RuntimeStatus struct expr.
This commit is contained in:
@@ -494,15 +494,17 @@ impl CoreInner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fn status(&self) -> RuntimeStatus {
|
async fn status(&self) -> RuntimeStatus {
|
||||||
|
let active_transfers = self
|
||||||
|
.active_transfers
|
||||||
|
.lock()
|
||||||
|
.expect("active_transfers")
|
||||||
|
.len() as u64;
|
||||||
|
let active_shares = self.active_shares.lock().await.len() as u64;
|
||||||
RuntimeStatus {
|
RuntimeStatus {
|
||||||
endpoint_id: self.endpoint.id().to_string(),
|
endpoint_id: self.endpoint.id().to_string(),
|
||||||
addr: format!("{:?}", self.endpoint.addr()),
|
addr: format!("{:?}", self.endpoint.addr()),
|
||||||
active_transfers: self
|
active_transfers,
|
||||||
.active_transfers
|
active_shares,
|
||||||
.lock()
|
|
||||||
.expect("active_transfers")
|
|
||||||
.len() as u64,
|
|
||||||
active_shares: self.active_shares.lock().await.len() as u64,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user