diff --git a/deltachat-ffi/src/lib.rs b/deltachat-ffi/src/lib.rs index aade1d4f2..857dda136 100644 --- a/deltachat-ffi/src/lib.rs +++ b/deltachat-ffi/src/lib.rs @@ -4868,7 +4868,7 @@ pub unsafe extern "C" fn dc_accounts_maybe_network_lost(accounts: *mut dc_accoun } let accounts = &*accounts; - block_on(async move { accounts.write().await.maybe_network_lost().await }); + block_on(async move { accounts.read().await.maybe_network_lost().await }); } #[no_mangle] @@ -4905,7 +4905,7 @@ pub unsafe extern "C" fn dc_accounts_set_push_device_token( let token = to_string_lossy(token); block_on(async move { - let mut accounts = accounts.write().await; + let accounts = accounts.read().await; if let Err(err) = accounts.set_push_device_token(&token).await { accounts.emit_event(EventType::Error(format!( "Failed to set notify token: {err:#}." diff --git a/src/accounts.rs b/src/accounts.rs index 663513ddd..e1cf7448f 100644 --- a/src/accounts.rs +++ b/src/accounts.rs @@ -344,7 +344,7 @@ impl Accounts { } /// Sets notification token for Apple Push Notification service. - pub async fn set_push_device_token(&mut self, token: &str) -> Result<()> { + pub async fn set_push_device_token(&self, token: &str) -> Result<()> { self.push_subscriber.set_device_token(token).await; Ok(()) } diff --git a/src/push.rs b/src/push.rs index a91cf155b..fbdf7ff5a 100644 --- a/src/push.rs +++ b/src/push.rs @@ -31,7 +31,7 @@ impl PushSubscriber { } /// Sets device token for Apple Push Notification service. - pub(crate) async fn set_device_token(&mut self, token: &str) { + pub(crate) async fn set_device_token(&self, token: &str) { self.inner.write().await.device_token = Some(token.to_string()); }