diff --git a/matrix_sdk_crypto/src/store/memorystore.rs b/matrix_sdk_crypto/src/store/memorystore.rs index bcfffe8f..f94b0a8b 100644 --- a/matrix_sdk_crypto/src/store/memorystore.rs +++ b/matrix_sdk_crypto/src/store/memorystore.rs @@ -30,8 +30,8 @@ use crate::{ pub struct MemoryStore { sessions: SessionStore, inbound_group_sessions: GroupSessionStore, - tracked_users: DashSet, - users_for_key_query: DashSet, + tracked_users: Arc>, + users_for_key_query: Arc>, devices: DeviceStore, } @@ -40,8 +40,8 @@ impl MemoryStore { MemoryStore { sessions: SessionStore::new(), inbound_group_sessions: GroupSessionStore::new(), - tracked_users: DashSet::new(), - users_for_key_query: DashSet::new(), + tracked_users: Arc::new(DashSet::new()), + users_for_key_query: Arc::new(DashSet::new()), devices: DeviceStore::new(), } } diff --git a/matrix_sdk_crypto/src/store/sqlite.rs b/matrix_sdk_crypto/src/store/sqlite.rs index c36d7420..17d67be5 100644 --- a/matrix_sdk_crypto/src/store/sqlite.rs +++ b/matrix_sdk_crypto/src/store/sqlite.rs @@ -45,16 +45,16 @@ pub struct SqliteStore { user_id: Arc, device_id: Arc>, account_info: Arc>>, - path: PathBuf, + path: Arc, sessions: SessionStore, inbound_group_sessions: GroupSessionStore, devices: DeviceStore, - tracked_users: DashSet, - users_for_key_query: DashSet, + tracked_users: Arc>, + users_for_key_query: Arc>, connection: Arc>, - pickle_passphrase: Option>, + pickle_passphrase: Arc>>, } #[derive(Clone)] @@ -136,11 +136,11 @@ impl SqliteStore { sessions: SessionStore::new(), inbound_group_sessions: GroupSessionStore::new(), devices: DeviceStore::new(), - path: path.as_ref().to_owned(), + path: Arc::new(path.as_ref().to_owned()), connection: Arc::new(Mutex::new(connection)), - pickle_passphrase: passphrase, - tracked_users: DashSet::new(), - users_for_key_query: DashSet::new(), + pickle_passphrase: Arc::new(passphrase), + tracked_users: Arc::new(DashSet::new()), + users_for_key_query: Arc::new(DashSet::new()), }; store.create_tables().await?; Ok(store) @@ -652,7 +652,7 @@ impl SqliteStore { } fn get_pickle_mode(&self) -> PicklingMode { - match &self.pickle_passphrase { + match &*self.pickle_passphrase { Some(p) => PicklingMode::Encrypted { key: p.as_bytes().to_vec(), },