Always use RwLock and Mutex from tokio
… instead of async-lock, which we previously used on wasm.pull/1712/head
parent
9bfd88cec4
commit
cd33d8ca38
|
@ -2836,7 +2836,6 @@ dependencies = [
|
|||
name = "matrix-sdk-common"
|
||||
version = "0.6.0"
|
||||
dependencies = [
|
||||
"async-lock",
|
||||
"futures-core",
|
||||
"futures-util",
|
||||
"gloo-timers",
|
||||
|
@ -3020,6 +3019,7 @@ dependencies = [
|
|||
"serde",
|
||||
"serde_json",
|
||||
"thiserror",
|
||||
"tokio",
|
||||
"tracing",
|
||||
"uuid",
|
||||
"wasm-bindgen",
|
||||
|
|
|
@ -109,7 +109,7 @@ pub struct Client {
|
|||
pub(crate) client: MatrixClient,
|
||||
delegate: Arc<RwLock<Option<Box<dyn ClientDelegate>>>>,
|
||||
session_verification_controller:
|
||||
Arc<matrix_sdk::locks::RwLock<Option<SessionVerificationController>>>,
|
||||
Arc<tokio::sync::RwLock<Option<SessionVerificationController>>>,
|
||||
/// The sliding sync proxy that the client is configured to use by default.
|
||||
/// If this value is `Some`, it will be automatically added to the builder
|
||||
/// when calling `sliding_sync()`.
|
||||
|
@ -120,7 +120,7 @@ pub struct Client {
|
|||
impl Client {
|
||||
pub fn new(client: MatrixClient) -> Self {
|
||||
let session_verification_controller: Arc<
|
||||
matrix_sdk::locks::RwLock<Option<SessionVerificationController>>,
|
||||
tokio::sync::RwLock<Option<SessionVerificationController>>,
|
||||
> = Default::default();
|
||||
let ctrl = session_verification_controller.clone();
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
use std::{future::Future, pin::Pin, sync::Arc};
|
||||
|
||||
use matrix_sdk::locks::Mutex;
|
||||
use tokio::sync::Mutex;
|
||||
|
||||
use crate::{
|
||||
ruma::api::appservice::query::{
|
||||
|
|
|
@ -43,6 +43,7 @@ once_cell = { workspace = true }
|
|||
ruma = { workspace = true, features = ["canonical-json"] }
|
||||
serde = { workspace = true, features = ["rc"] }
|
||||
serde_json = { workspace = true }
|
||||
tokio = { version = "1.24", default-features = false, features = ["sync"] }
|
||||
thiserror = { workspace = true }
|
||||
tracing = { workspace = true }
|
||||
zeroize = { workspace = true, features = ["zeroize_derive"] }
|
||||
|
|
|
@ -22,7 +22,7 @@ use std::{
|
|||
use std::{ops::Deref, sync::Arc};
|
||||
|
||||
use eyeball::Subscriber;
|
||||
use matrix_sdk_common::{instant::Instant, locks::RwLock};
|
||||
use matrix_sdk_common::instant::Instant;
|
||||
#[cfg(feature = "e2e-encryption")]
|
||||
use matrix_sdk_crypto::{
|
||||
store::DynCryptoStore, EncryptionSettings, OlmError, OlmMachine, ToDeviceRequest,
|
||||
|
@ -53,6 +53,7 @@ use ruma::{
|
|||
serde::Raw,
|
||||
MilliSecondsSinceUnixEpoch, OwnedUserId, RoomId, UInt, UserId,
|
||||
};
|
||||
use tokio::sync::RwLock;
|
||||
use tracing::{debug, info, trace, warn};
|
||||
|
||||
#[cfg(feature = "e2e-encryption")]
|
||||
|
|
|
@ -19,8 +19,7 @@ use std::{
|
|||
|
||||
use async_trait::async_trait;
|
||||
use dashmap::{DashMap, DashSet};
|
||||
#[allow(unused_imports)]
|
||||
use matrix_sdk_common::{instant::Instant, locks::Mutex};
|
||||
use matrix_sdk_common::instant::Instant;
|
||||
use ruma::{
|
||||
canonical_json::redact,
|
||||
events::{
|
||||
|
@ -117,7 +116,7 @@ impl MemoryStore {
|
|||
room_user_receipts: Default::default(),
|
||||
room_event_receipts: Default::default(),
|
||||
#[cfg(feature = "memory-media-cache")]
|
||||
media: Arc::new(Mutex::new(LruCache::new(
|
||||
media: Arc::new(tokio::sync::Mutex::new(LruCache::new(
|
||||
100.try_into().expect("100 is a non-zero usize"),
|
||||
))),
|
||||
custom: DashMap::new().into(),
|
||||
|
|
|
@ -39,7 +39,6 @@ pub mod integration_tests;
|
|||
mod traits;
|
||||
|
||||
use dashmap::DashMap;
|
||||
use matrix_sdk_common::locks::RwLock;
|
||||
#[cfg(feature = "e2e-encryption")]
|
||||
use matrix_sdk_crypto::store::{DynCryptoStore, IntoCryptoStore};
|
||||
pub use matrix_sdk_store_encryption::Error as StoreEncryptionError;
|
||||
|
@ -58,6 +57,7 @@ use ruma::{
|
|||
serde::Raw,
|
||||
EventId, OwnedEventId, OwnedRoomId, OwnedUserId, RoomId, UserId,
|
||||
};
|
||||
use tokio::sync::RwLock;
|
||||
|
||||
/// BoxStream of owned Types
|
||||
pub type BoxStream<T> = Pin<Box<dyn futures_util::Stream<Item = T> + Send>>;
|
||||
|
|
|
@ -26,7 +26,6 @@ serde = { workspace = true }
|
|||
serde_json = { workspace = true }
|
||||
|
||||
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
||||
async-lock = "2.5.0"
|
||||
futures-util = { workspace = true, features = ["channel"] }
|
||||
wasm-bindgen-futures = { version = "0.4.33", optional = true }
|
||||
gloo-timers = { version = "0.2.6", features = ["futures"] }
|
||||
|
|
|
@ -5,7 +5,6 @@ pub use instant;
|
|||
|
||||
pub mod deserialized_responses;
|
||||
pub mod executor;
|
||||
pub mod locks;
|
||||
pub mod timeout;
|
||||
|
||||
/// Alias for `Send` on non-wasm, empty trait (implemented by everything) on
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
#[cfg(target_arch = "wasm32")]
|
||||
pub use async_lock::{Mutex, MutexGuard, RwLock, RwLockReadGuard, RwLockWriteGuard};
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
pub use tokio::sync::{Mutex, MutexGuard, RwLock, RwLockReadGuard, RwLockWriteGuard};
|
|
@ -58,6 +58,9 @@ vodozemac = { workspace = true }
|
|||
zeroize = { workspace = true, features = ["zeroize_derive"] }
|
||||
cfg-if = "1.0"
|
||||
|
||||
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
||||
tokio = { version = "1.24", default-features = false, features = ["sync"] }
|
||||
|
||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||
tokio = { version = "1.24", default-features = false, features = ["time"] }
|
||||
|
||||
|
|
|
@ -28,11 +28,11 @@ use std::{
|
|||
sync::Arc,
|
||||
};
|
||||
|
||||
use matrix_sdk_common::locks::RwLock;
|
||||
use ruma::{
|
||||
api::client::backup::RoomKeyBackup, serde::Raw, DeviceId, DeviceKeyAlgorithm, OwnedDeviceId,
|
||||
OwnedRoomId, OwnedTransactionId, TransactionId,
|
||||
};
|
||||
use tokio::sync::RwLock;
|
||||
use tracing::{debug, info, instrument, trace, warn};
|
||||
|
||||
use crate::{
|
||||
|
|
|
@ -1039,7 +1039,6 @@ mod tests {
|
|||
#[cfg(feature = "automatic-room-key-forwarding")]
|
||||
use assert_matches::assert_matches;
|
||||
use dashmap::DashMap;
|
||||
use matrix_sdk_common::locks::Mutex;
|
||||
use matrix_sdk_test::async_test;
|
||||
use ruma::{
|
||||
device_id, event_id,
|
||||
|
@ -1054,6 +1053,7 @@ mod tests {
|
|||
#[cfg(feature = "automatic-room-key-forwarding")]
|
||||
use serde::{de::DeserializeOwned, Serialize};
|
||||
use serde_json::json;
|
||||
use tokio::sync::Mutex;
|
||||
|
||||
use super::GossipMachine;
|
||||
#[cfg(feature = "automatic-room-key-forwarding")]
|
||||
|
|
|
@ -23,7 +23,6 @@ use std::{
|
|||
};
|
||||
|
||||
use atomic::Atomic;
|
||||
use matrix_sdk_common::locks::Mutex;
|
||||
use ruma::{
|
||||
api::client::keys::upload_signatures::v3::Request as SignatureUploadRequest,
|
||||
events::key::verification::VerificationMethod, serde::Raw, DeviceId, DeviceKeyAlgorithm,
|
||||
|
@ -31,6 +30,7 @@ use ruma::{
|
|||
};
|
||||
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
||||
use serde_json::Value;
|
||||
use tokio::sync::Mutex;
|
||||
use tracing::{trace, warn};
|
||||
use vodozemac::{olm::SessionConfig, Curve25519PublicKey, Ed25519PublicKey};
|
||||
|
||||
|
|
|
@ -20,12 +20,13 @@ use std::{
|
|||
|
||||
use futures_util::future::join_all;
|
||||
use itertools::Itertools;
|
||||
use matrix_sdk_common::{executor::spawn, locks::Mutex};
|
||||
use matrix_sdk_common::executor::spawn;
|
||||
use ruma::{
|
||||
api::client::keys::get_keys::v3::Response as KeysQueryResponse, serde::Raw, DeviceId,
|
||||
OwnedDeviceId, OwnedServerName, OwnedTransactionId, OwnedUserId, ServerName, TransactionId,
|
||||
UserId,
|
||||
};
|
||||
use tokio::sync::Mutex;
|
||||
use tracing::{debug, info, instrument, trace, warn};
|
||||
|
||||
use crate::{
|
||||
|
@ -718,12 +719,12 @@ pub(crate) mod testing {
|
|||
#![allow(dead_code)]
|
||||
use std::sync::Arc;
|
||||
|
||||
use matrix_sdk_common::locks::Mutex;
|
||||
use ruma::{
|
||||
api::{client::keys::get_keys::v3::Response as KeyQueryResponse, IncomingResponse},
|
||||
device_id, user_id, DeviceId, UserId,
|
||||
};
|
||||
use serde_json::json;
|
||||
use tokio::sync::Mutex;
|
||||
|
||||
use crate::{
|
||||
identities::IdentityManager,
|
||||
|
|
|
@ -702,10 +702,10 @@ pub(crate) mod tests {
|
|||
use std::sync::Arc;
|
||||
|
||||
use assert_matches::assert_matches;
|
||||
use matrix_sdk_common::locks::Mutex;
|
||||
use matrix_sdk_test::async_test;
|
||||
use ruma::user_id;
|
||||
use serde_json::{json, Value};
|
||||
use tokio::sync::Mutex;
|
||||
|
||||
use super::{
|
||||
testing::{device, get_other_identity, get_own_identity},
|
||||
|
|
|
@ -19,12 +19,9 @@ use std::{
|
|||
};
|
||||
|
||||
use dashmap::DashMap;
|
||||
use matrix_sdk_common::{
|
||||
deserialized_responses::{
|
||||
AlgorithmInfo, DeviceLinkProblem, EncryptionInfo, TimelineEvent, VerificationLevel,
|
||||
VerificationState,
|
||||
},
|
||||
locks::Mutex,
|
||||
use matrix_sdk_common::deserialized_responses::{
|
||||
AlgorithmInfo, DeviceLinkProblem, EncryptionInfo, TimelineEvent, VerificationLevel,
|
||||
VerificationState,
|
||||
};
|
||||
use ruma::{
|
||||
api::client::{
|
||||
|
@ -45,6 +42,7 @@ use ruma::{
|
|||
RoomId, TransactionId, UInt, UserId,
|
||||
};
|
||||
use serde_json::{value::to_raw_value, Value};
|
||||
use tokio::sync::Mutex;
|
||||
use tracing::{
|
||||
debug, error,
|
||||
field::{debug, display},
|
||||
|
|
|
@ -22,7 +22,6 @@ use std::{
|
|||
},
|
||||
};
|
||||
|
||||
use matrix_sdk_common::locks::Mutex;
|
||||
use ruma::{
|
||||
api::client::keys::{
|
||||
upload_keys,
|
||||
|
@ -36,6 +35,7 @@ use ruma::{
|
|||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::{value::RawValue as RawJsonValue, Value};
|
||||
use sha2::{Digest, Sha256};
|
||||
use tokio::sync::Mutex;
|
||||
use tracing::{debug, info, instrument, trace, warn, Span};
|
||||
use vodozemac::{
|
||||
olm::{
|
||||
|
|
|
@ -21,7 +21,6 @@ use std::{
|
|||
},
|
||||
};
|
||||
|
||||
use matrix_sdk_common::locks::Mutex;
|
||||
use ruma::{
|
||||
events::{room::history_visibility::HistoryVisibility, AnyTimelineEvent},
|
||||
serde::Raw,
|
||||
|
@ -29,6 +28,7 @@ use ruma::{
|
|||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::Value;
|
||||
use tokio::sync::Mutex;
|
||||
use vodozemac::{
|
||||
megolm::{
|
||||
DecryptedMessage, DecryptionError, InboundGroupSession as InnerSession,
|
||||
|
|
|
@ -24,7 +24,6 @@ use std::{
|
|||
};
|
||||
|
||||
use dashmap::DashMap;
|
||||
use matrix_sdk_common::locks::RwLock;
|
||||
use ruma::{
|
||||
events::room::{encryption::RoomEncryptionEventContent, history_visibility::HistoryVisibility},
|
||||
serde::Raw,
|
||||
|
@ -33,6 +32,7 @@ use ruma::{
|
|||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::{json, Value};
|
||||
use tokio::sync::RwLock;
|
||||
use tracing::{debug, error, info};
|
||||
use vodozemac::{megolm::SessionConfig, Curve25519PublicKey};
|
||||
pub use vodozemac::{
|
||||
|
|
|
@ -14,10 +14,10 @@
|
|||
|
||||
use std::{fmt, sync::Arc};
|
||||
|
||||
use matrix_sdk_common::locks::Mutex;
|
||||
use ruma::{serde::Raw, DeviceId, SecondsSinceUnixEpoch, UserId};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::{json, Value};
|
||||
use tokio::sync::Mutex;
|
||||
use vodozemac::{
|
||||
olm::{DecryptionError, OlmMessage, Session as InnerSession, SessionConfig, SessionPickle},
|
||||
Curve25519PublicKey,
|
||||
|
|
|
@ -19,7 +19,6 @@ use std::sync::{
|
|||
Arc,
|
||||
};
|
||||
|
||||
use matrix_sdk_common::locks::Mutex;
|
||||
use pk_signing::{MasterSigning, PickledSignings, SelfSigning, Signing, SigningError, UserSigning};
|
||||
use ruma::{
|
||||
api::client::keys::upload_signatures::v3::{Request as SignatureUploadRequest, SignedKeys},
|
||||
|
@ -28,6 +27,7 @@ use ruma::{
|
|||
DeviceKeyAlgorithm, DeviceKeyId, OwnedDeviceId, OwnedDeviceKeyId, OwnedUserId, UserId,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tokio::sync::Mutex;
|
||||
use vodozemac::Ed25519Signature;
|
||||
|
||||
use crate::{
|
||||
|
|
|
@ -397,7 +397,6 @@ mod tests {
|
|||
use std::{collections::BTreeMap, iter, ops::Deref, sync::Arc};
|
||||
|
||||
use dashmap::DashMap;
|
||||
use matrix_sdk_common::locks::Mutex;
|
||||
use matrix_sdk_test::{async_test, response_from_file};
|
||||
use ruma::{
|
||||
api::{
|
||||
|
@ -410,6 +409,7 @@ mod tests {
|
|||
device_id, user_id, DeviceId, UserId,
|
||||
};
|
||||
use serde_json::json;
|
||||
use tokio::sync::Mutex;
|
||||
use tracing::info;
|
||||
|
||||
use super::SessionManager;
|
||||
|
|
|
@ -25,8 +25,8 @@ use std::{
|
|||
|
||||
use atomic::Ordering;
|
||||
use dashmap::DashMap;
|
||||
use matrix_sdk_common::locks::Mutex;
|
||||
use ruma::{DeviceId, OwnedDeviceId, OwnedRoomId, OwnedUserId, RoomId, UserId};
|
||||
use tokio::sync::Mutex;
|
||||
use tracing::{field::display, instrument, trace, Span};
|
||||
|
||||
use crate::{
|
||||
|
|
|
@ -16,10 +16,10 @@ use std::{collections::HashMap, convert::Infallible, sync::Arc};
|
|||
|
||||
use async_trait::async_trait;
|
||||
use dashmap::{DashMap, DashSet};
|
||||
use matrix_sdk_common::locks::Mutex;
|
||||
use ruma::{
|
||||
DeviceId, OwnedDeviceId, OwnedTransactionId, OwnedUserId, RoomId, TransactionId, UserId,
|
||||
};
|
||||
use tokio::sync::Mutex;
|
||||
use tracing::warn;
|
||||
|
||||
use super::{
|
||||
|
|
|
@ -49,12 +49,12 @@ use std::{
|
|||
use async_std::sync::{Condvar, Mutex as AsyncStdMutex};
|
||||
use atomic::Ordering;
|
||||
use dashmap::DashSet;
|
||||
use matrix_sdk_common::locks::Mutex;
|
||||
use ruma::{
|
||||
events::secret::request::SecretName, DeviceId, OwnedDeviceId, OwnedRoomId, OwnedUserId, UserId,
|
||||
};
|
||||
use serde::{de::DeserializeOwned, Deserialize, Serialize};
|
||||
use thiserror::Error;
|
||||
use tokio::sync::Mutex;
|
||||
use tracing::{info, warn};
|
||||
use vodozemac::{megolm::SessionOrdering, Curve25519PublicKey};
|
||||
use zeroize::Zeroize;
|
||||
|
|
|
@ -15,8 +15,9 @@
|
|||
use std::{collections::HashMap, fmt, sync::Arc};
|
||||
|
||||
use async_trait::async_trait;
|
||||
use matrix_sdk_common::{locks::Mutex, AsyncTraitDeps};
|
||||
use matrix_sdk_common::AsyncTraitDeps;
|
||||
use ruma::{DeviceId, OwnedDeviceId, RoomId, TransactionId, UserId};
|
||||
use tokio::sync::Mutex;
|
||||
|
||||
use super::{BackupKeys, Changes, CryptoStoreError, Result, RoomKeyCounts, RoomSettings};
|
||||
use crate::{
|
||||
|
|
|
@ -18,7 +18,6 @@ use std::{
|
|||
};
|
||||
|
||||
use dashmap::DashMap;
|
||||
use matrix_sdk_common::locks::Mutex;
|
||||
use ruma::{
|
||||
events::{
|
||||
key::verification::VerificationMethod, AnyToDeviceEvent, AnyToDeviceEventContent,
|
||||
|
@ -28,6 +27,7 @@ use ruma::{
|
|||
uint, DeviceId, EventId, MilliSecondsSinceUnixEpoch, OwnedDeviceId, OwnedUserId, RoomId,
|
||||
SecondsSinceUnixEpoch, TransactionId, UInt, UserId,
|
||||
};
|
||||
use tokio::sync::Mutex;
|
||||
use tracing::{debug, info, instrument, trace, warn};
|
||||
|
||||
use super::{
|
||||
|
@ -527,9 +527,9 @@ impl VerificationMachine {
|
|||
mod tests {
|
||||
use std::sync::Arc;
|
||||
|
||||
use matrix_sdk_common::locks::Mutex;
|
||||
use matrix_sdk_test::async_test;
|
||||
use ruma::TransactionId;
|
||||
use tokio::sync::Mutex;
|
||||
|
||||
use super::{Sas, VerificationMachine};
|
||||
use crate::{
|
||||
|
|
|
@ -24,7 +24,6 @@ use std::{collections::HashMap, ops::Deref, sync::Arc};
|
|||
|
||||
use event_enums::OutgoingContent;
|
||||
pub use machine::VerificationMachine;
|
||||
use matrix_sdk_common::locks::Mutex;
|
||||
#[cfg(feature = "qrcode")]
|
||||
pub use qrcode::{QrVerification, QrVerificationState, ScanError};
|
||||
pub use requests::{VerificationRequest, VerificationRequestState};
|
||||
|
@ -46,6 +45,7 @@ use ruma::{
|
|||
UserId,
|
||||
};
|
||||
pub use sas::{AcceptSettings, AcceptedProtocols, EmojiShortAuthString, Sas, SasState};
|
||||
use tokio::sync::Mutex;
|
||||
use tracing::{error, info, trace, warn};
|
||||
|
||||
use crate::{
|
||||
|
@ -812,8 +812,8 @@ pub(crate) mod tests {
|
|||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use matrix_sdk_common::locks::Mutex;
|
||||
use ruma::{device_id, user_id, DeviceId, UserId};
|
||||
use tokio::sync::Mutex;
|
||||
|
||||
use super::VerificationStore;
|
||||
use crate::{
|
||||
|
|
|
@ -847,10 +847,10 @@ mod tests {
|
|||
use std::sync::Arc;
|
||||
|
||||
use assert_matches::assert_matches;
|
||||
use matrix_sdk_common::locks::Mutex;
|
||||
use matrix_sdk_qrcode::QrVerificationData;
|
||||
use matrix_sdk_test::async_test;
|
||||
use ruma::{device_id, event_id, room_id, user_id, DeviceId, UserId};
|
||||
use tokio::sync::Mutex;
|
||||
|
||||
use crate::{
|
||||
olm::{PrivateCrossSigningIdentity, ReadOnlyAccount},
|
||||
|
|
|
@ -854,9 +854,9 @@ impl AcceptSettings {
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use assert_matches::assert_matches;
|
||||
use matrix_sdk_common::locks::Mutex;
|
||||
use matrix_sdk_test::async_test;
|
||||
use ruma::{device_id, user_id, DeviceId, TransactionId, UserId};
|
||||
use tokio::sync::Mutex;
|
||||
|
||||
use super::Sas;
|
||||
use crate::{
|
||||
|
|
|
@ -32,6 +32,7 @@ ruma = { workspace = true }
|
|||
serde = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
thiserror = { workspace = true }
|
||||
tokio = { version = "1.24", default-features = false, features = ["sync"] }
|
||||
tracing = { workspace = true }
|
||||
wasm-bindgen = "0.2.83"
|
||||
web-sys = { version = "0.3.57", features = ["IdbKeyRange"] }
|
||||
|
|
|
@ -20,7 +20,6 @@ use std::{
|
|||
use async_trait::async_trait;
|
||||
use gloo_utils::format::JsValueSerdeExt;
|
||||
use indexed_db_futures::prelude::*;
|
||||
use matrix_sdk_base::locks::Mutex;
|
||||
use matrix_sdk_crypto::{
|
||||
olm::{
|
||||
IdentityKeys, InboundGroupSession, OlmMessageHash, OutboundGroupSession,
|
||||
|
@ -36,6 +35,7 @@ use matrix_sdk_crypto::{
|
|||
use matrix_sdk_store_encryption::StoreCipher;
|
||||
use ruma::{DeviceId, OwnedDeviceId, RoomId, TransactionId, UserId};
|
||||
use serde::{de::DeserializeOwned, Serialize};
|
||||
use tokio::sync::Mutex;
|
||||
use wasm_bindgen::JsValue;
|
||||
use web_sys::IdbKeyRange;
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@ use std::{
|
|||
};
|
||||
|
||||
use async_trait::async_trait;
|
||||
use matrix_sdk_common::locks::Mutex;
|
||||
use matrix_sdk_crypto::{
|
||||
olm::{
|
||||
IdentityKeys, InboundGroupSession, OutboundGroupSession, PickledInboundGroupSession,
|
||||
|
@ -41,6 +40,7 @@ use sled::{
|
|||
transaction::{ConflictableTransactionError, TransactionError},
|
||||
Batch, Config, Db, IVec, Transactional, Tree,
|
||||
};
|
||||
use tokio::sync::Mutex;
|
||||
use tracing::debug;
|
||||
|
||||
use super::OpenStoreError;
|
||||
|
|
|
@ -21,7 +21,6 @@ use std::{
|
|||
|
||||
use async_trait::async_trait;
|
||||
use deadpool_sqlite::{Object as SqliteConn, Pool as SqlitePool, Runtime};
|
||||
use matrix_sdk_common::locks::Mutex;
|
||||
use matrix_sdk_crypto::{
|
||||
olm::{
|
||||
IdentityKeys, InboundGroupSession, OutboundGroupSession, PickledInboundGroupSession,
|
||||
|
@ -35,7 +34,7 @@ use matrix_sdk_store_encryption::StoreCipher;
|
|||
use ruma::{DeviceId, OwnedDeviceId, RoomId, TransactionId, UserId};
|
||||
use rusqlite::OptionalExtension;
|
||||
use serde::{de::DeserializeOwned, Serialize};
|
||||
use tokio::fs;
|
||||
use tokio::{fs, sync::Mutex};
|
||||
use tracing::{debug, error, instrument, warn};
|
||||
|
||||
use crate::{
|
||||
|
|
|
@ -15,17 +15,13 @@
|
|||
|
||||
use std::{fmt, sync::Arc};
|
||||
|
||||
use matrix_sdk_base::{
|
||||
locks::{Mutex, RwLock},
|
||||
store::StoreConfig,
|
||||
BaseClient,
|
||||
};
|
||||
use matrix_sdk_base::{store::StoreConfig, BaseClient};
|
||||
use ruma::{
|
||||
api::{client::discovery::discover_homeserver, error::FromHttpResponseError, MatrixVersion},
|
||||
OwnedServerName, ServerName,
|
||||
};
|
||||
use thiserror::Error;
|
||||
use tokio::sync::{broadcast, OnceCell};
|
||||
use tokio::sync::{broadcast, Mutex, OnceCell, RwLock};
|
||||
use tracing::{
|
||||
debug,
|
||||
field::{self, debug},
|
||||
|
|
|
@ -29,10 +29,7 @@ use matrix_sdk_base::{
|
|||
store::DynStateStore, BaseClient, RoomState, SendOutsideWasm, Session, SessionMeta,
|
||||
SessionTokens, SyncOutsideWasm,
|
||||
};
|
||||
use matrix_sdk_common::{
|
||||
instant::Instant,
|
||||
locks::{Mutex, RwLock, RwLockReadGuard},
|
||||
};
|
||||
use matrix_sdk_common::instant::Instant;
|
||||
#[cfg(feature = "appservice")]
|
||||
use ruma::TransactionId;
|
||||
use ruma::{
|
||||
|
@ -67,7 +64,7 @@ use ruma::{
|
|||
ServerName, UInt, UserId,
|
||||
};
|
||||
use serde::de::DeserializeOwned;
|
||||
use tokio::sync::{broadcast, OnceCell};
|
||||
use tokio::sync::{broadcast, Mutex, OnceCell, RwLock, RwLockReadGuard};
|
||||
use tracing::{debug, error, field::display, info, instrument, trace, Instrument, Span};
|
||||
use url::Url;
|
||||
|
||||
|
@ -1419,12 +1416,9 @@ impl Client {
|
|||
/// [`UnknownToken`]: ruma::api::client::error::ErrorKind::UnknownToken
|
||||
/// [restore the session]: Client::restore_session
|
||||
pub async fn refresh_access_token(&self) -> HttpResult<Option<refresh_token::v3::Response>> {
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
let lock = self.inner.refresh_token_lock.try_lock().ok();
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
let lock = self.inner.refresh_token_lock.try_lock();
|
||||
|
||||
if let Some(mut guard) = lock {
|
||||
if let Ok(mut guard) = lock {
|
||||
let Some(mut session_tokens) = self.session_tokens() else {
|
||||
*guard = Err(RefreshTokenError::RefreshTokenRequired);
|
||||
return Err(RefreshTokenError::RefreshTokenRequired.into());
|
||||
|
|
|
@ -14,12 +14,8 @@
|
|||
|
||||
use std::sync::Arc;
|
||||
|
||||
use matrix_sdk_base::{
|
||||
crypto::{
|
||||
types::MasterPubkey, OwnUserIdentity as InnerOwnUserIdentity,
|
||||
UserIdentity as InnerUserIdentity,
|
||||
},
|
||||
locks::RwLock,
|
||||
use matrix_sdk_base::crypto::{
|
||||
types::MasterPubkey, OwnUserIdentity as InnerOwnUserIdentity, UserIdentity as InnerUserIdentity,
|
||||
};
|
||||
use ruma::{
|
||||
events::{
|
||||
|
@ -28,6 +24,7 @@ use ruma::{
|
|||
},
|
||||
UserId,
|
||||
};
|
||||
use tokio::sync::RwLock;
|
||||
|
||||
use super::{ManualVerifyError, RequestVerificationError};
|
||||
use crate::{encryption::verification::VerificationRequest, room::Joined, Client};
|
||||
|
|
|
@ -5,7 +5,6 @@ use matrix_sdk_base::{
|
|||
store::StateStoreExt,
|
||||
StateChanges,
|
||||
};
|
||||
use matrix_sdk_common::locks::Mutex;
|
||||
#[cfg(feature = "e2e-encryption")]
|
||||
use ruma::events::{
|
||||
room::encrypted::OriginalSyncRoomEncryptedEvent, AnySyncMessageLikeEvent, AnySyncTimelineEvent,
|
||||
|
@ -46,6 +45,7 @@ use ruma::{
|
|||
UInt, UserId,
|
||||
};
|
||||
use serde::de::DeserializeOwned;
|
||||
use tokio::sync::Mutex;
|
||||
use tracing::debug;
|
||||
|
||||
#[cfg(feature = "experimental-timeline")]
|
||||
|
|
|
@ -5,8 +5,6 @@ use std::sync::Arc;
|
|||
use std::{borrow::Borrow, ops::Deref};
|
||||
|
||||
use matrix_sdk_common::instant::{Duration, Instant};
|
||||
#[cfg(feature = "e2e-encryption")]
|
||||
use matrix_sdk_common::locks::Mutex;
|
||||
use mime::{self, Mime};
|
||||
use ruma::{
|
||||
api::client::{
|
||||
|
@ -38,6 +36,8 @@ use ruma::{
|
|||
EventId, Int, MxcUri, OwnedEventId, OwnedTransactionId, TransactionId, UserId,
|
||||
};
|
||||
use serde_json::Value;
|
||||
#[cfg(feature = "e2e-encryption")]
|
||||
use tokio::sync::Mutex;
|
||||
use tracing::{debug, instrument};
|
||||
|
||||
use super::Left;
|
||||
|
|
|
@ -15,14 +15,12 @@
|
|||
use std::sync::Arc;
|
||||
|
||||
use imbl::Vector;
|
||||
use matrix_sdk_base::{
|
||||
deserialized_responses::{EncryptionInfo, SyncTimelineEvent},
|
||||
locks::Mutex,
|
||||
};
|
||||
use matrix_sdk_base::deserialized_responses::{EncryptionInfo, SyncTimelineEvent};
|
||||
use ruma::{
|
||||
events::receipt::{ReceiptThread, ReceiptType, SyncReceiptEvent},
|
||||
push::Action,
|
||||
};
|
||||
use tokio::sync::Mutex;
|
||||
use tracing::error;
|
||||
|
||||
#[cfg(feature = "e2e-encryption")]
|
||||
|
|
|
@ -22,10 +22,7 @@ use imbl::Vector;
|
|||
use indexmap::{IndexMap, IndexSet};
|
||||
#[cfg(feature = "e2e-encryption")]
|
||||
use matrix_sdk_base::crypto::OlmMachine;
|
||||
use matrix_sdk_base::{
|
||||
deserialized_responses::{EncryptionInfo, SyncTimelineEvent, TimelineEvent},
|
||||
locks::{Mutex, MutexGuard},
|
||||
};
|
||||
use matrix_sdk_base::deserialized_responses::{EncryptionInfo, SyncTimelineEvent, TimelineEvent};
|
||||
#[cfg(feature = "e2e-encryption")]
|
||||
use ruma::RoomId;
|
||||
use ruma::{
|
||||
|
@ -41,6 +38,7 @@ use ruma::{
|
|||
EventId, MilliSecondsSinceUnixEpoch, OwnedEventId, OwnedTransactionId, OwnedUserId,
|
||||
TransactionId, UserId,
|
||||
};
|
||||
use tokio::sync::{Mutex, MutexGuard};
|
||||
use tracing::{debug, error, field::debug, instrument, trace, warn};
|
||||
#[cfg(feature = "e2e-encryption")]
|
||||
use tracing::{field, info, info_span, Instrument as _};
|
||||
|
|
|
@ -21,7 +21,6 @@ use std::{pin::Pin, sync::Arc, task::Poll};
|
|||
use eyeball_im::{VectorDiff, VectorSubscriber};
|
||||
use futures_core::Stream;
|
||||
use imbl::Vector;
|
||||
use matrix_sdk_base::locks::Mutex;
|
||||
use pin_project_lite::pin_project;
|
||||
use ruma::{
|
||||
api::client::receipt::create_receipt::v3::ReceiptType,
|
||||
|
@ -33,6 +32,7 @@ use ruma::{
|
|||
EventId, MilliSecondsSinceUnixEpoch, OwnedEventId, TransactionId, UserId,
|
||||
};
|
||||
use thiserror::Error;
|
||||
use tokio::sync::Mutex;
|
||||
use tracing::{error, instrument, warn};
|
||||
|
||||
use super::{Joined, Receipts};
|
||||
|
|
|
@ -558,7 +558,6 @@ use eyeball::unique::Observable;
|
|||
use futures_core::stream::Stream;
|
||||
pub use list::*;
|
||||
use matrix_sdk_base::sync::SyncResponse;
|
||||
use matrix_sdk_common::locks::Mutex as AsyncMutex;
|
||||
pub use room::*;
|
||||
use ruma::{
|
||||
api::client::{
|
||||
|
@ -570,7 +569,7 @@ use ruma::{
|
|||
assign, OwnedRoomId, RoomId,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tokio::spawn;
|
||||
use tokio::{spawn, sync::Mutex as AsyncMutex};
|
||||
use tracing::{debug, error, info_span, instrument, trace, warn, Instrument, Span};
|
||||
use url::Url;
|
||||
use uuid::Uuid;
|
||||
|
|
Loading…
Reference in New Issue