Skip to content

Commit

Permalink
server: Remove unecessary clone
Browse files Browse the repository at this point in the history
Session is already Clone, no need for an extra Arc wrapper.
  • Loading branch information
bilelmoussaoui committed Dec 4, 2024
1 parent 570178a commit 0cf7fb2
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions server/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub struct Service {
// Other attributes
connection: zbus::Connection,
// sessions mapped to their corresponding object path on the bus
sessions: Arc<Mutex<HashMap<OwnedObjectPath, Arc<Session>>>>,
sessions: Arc<Mutex<HashMap<OwnedObjectPath, Session>>>,
session_index: Arc<RwLock<u32>>,
}

Expand Down Expand Up @@ -55,13 +55,10 @@ impl Service {
let session = Session::new(aes_key.map(Arc::new), self.clone()).await;
let path = session.path().clone();

{
let session = Arc::new(session.clone());
self.sessions
.lock()
.await
.insert(path.clone(), Arc::clone(&session));
}
self.sessions
.lock()
.await
.insert(path.clone(), session.clone());

object_server.at(&path, session).await?;

Expand Down

0 comments on commit 0cf7fb2

Please sign in to comment.