Skip to content

Commit

Permalink
Use tokio::sync::Mutex
Browse files Browse the repository at this point in the history
  • Loading branch information
gferon committed Nov 16, 2023
1 parent 576dcac commit 88e8a44
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion presage/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ serde_json = "1.0"
thiserror = "1.0"
url = "2.2"
parking_lot = "0.11"
tokio = { version = "1.0", default-features = false, features = ["time"] }
tokio = { version = "1.0", default-features = false, features = ["sync", "time"] }

[dev-dependencies]
quickcheck = "1.0.3"
Expand Down
6 changes: 3 additions & 3 deletions presage/src/manager/registered.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ use libsignal_service::zkgroup::profiles::ProfileKey;
use libsignal_service::{cipher, AccountManager, Profile, ServiceAddress};
use libsignal_service_hyper::push_service::HyperPushService;
use log::{debug, error, info, trace, warn};
use parking_lot::Mutex;
use rand::rngs::StdRng;
use rand::SeedableRng;
use serde::{Deserialize, Serialize};
use tokio::sync::Mutex;

use crate::cache::CacheCell;
use crate::serde::serde_profile_key;
Expand Down Expand Up @@ -201,7 +201,7 @@ impl<S: Store> Manager<S, Registered> {

/// Returns the current identified websocket, or creates a new one
async fn identified_websocket(&self) -> Result<SignalWebSocket, Error<S::Error>> {
let mut identified_ws = self.state.identified_websocket.lock();
let mut identified_ws = self.state.identified_websocket.lock().await;
match identified_ws.clone() {
Some(ws) => Ok(ws),
None => {
Expand All @@ -220,7 +220,7 @@ impl<S: Store> Manager<S, Registered> {
}

async fn unidentified_websocket(&self) -> Result<SignalWebSocket, Error<S::Error>> {
let mut unidentified_ws = self.state.unidentified_websocket.lock();
let mut unidentified_ws = self.state.unidentified_websocket.lock().await;
match unidentified_ws.clone() {
Some(ws) => Ok(ws),
None => {
Expand Down

0 comments on commit 88e8a44

Please sign in to comment.