diff --git a/server/src/daemon/service_manager.rs b/server/src/daemon/service_manager.rs index f127d4f13..c6870e88a 100644 --- a/server/src/daemon/service_manager.rs +++ b/server/src/daemon/service_manager.rs @@ -1,36 +1,30 @@ use std::collections::HashMap; -use tokio::sync::RwLock; use zbus::zvariant::{ObjectPath, OwnedObjectPath}; use super::session::Session; #[derive(Debug)] pub struct ServiceManager { - sessions: RwLock>, + sessions: HashMap, } impl ServiceManager { pub fn new() -> Self { Self { - sessions: RwLock::new(HashMap::new()), + sessions: HashMap::new(), } } - pub async fn session(&self, path: ObjectPath<'_>) -> Option { - self.sessions - .read() - .await - .get(&path.into()) - .to_owned() - .cloned() + pub fn session(&self, path: ObjectPath<'_>) -> Option { + self.sessions.get(&path.into()).to_owned().cloned() } - pub async fn insert_session(&mut self, path: ObjectPath<'_>, session: Session) { - self.sessions.write().await.insert(path.into(), session); + pub fn insert_session(&mut self, path: ObjectPath<'_>, session: Session) { + self.sessions.insert(path.into(), session); } - pub async fn remove_session(&mut self, path: ObjectPath<'_>) { - self.sessions.write().await.remove(&path.into()); + pub fn remove_session(&mut self, path: ObjectPath<'_>) { + self.sessions.remove(&path.into()); } }