Try to resume backups if we restore the client

This commit is contained in:
Damir Jelić
2023-10-22 15:10:40 +02:00
parent 4fda5e5ff0
commit 747c00c265
3 changed files with 17 additions and 4 deletions
+14 -1
View File
@@ -915,6 +915,19 @@ impl Client {
}
}
pub(crate) async fn set_session_meta(&self, session_meta: SessionMeta) -> Result<()> {
self.base_client().set_session_meta(session_meta).await?;
#[cfg(feature = "e2e-encryption")]
{
if let Err(e) = self.encryption().backups().setup_and_resume().await {
error!("Couldn't setup and resume backups {e:?}");
}
}
Ok(())
}
/// Refresh the access token using the authentication API used to log into
/// this session.
///
@@ -1955,7 +1968,7 @@ impl Client {
// overwrite the session information shared with the parent too, and it
// must be initialized at most once.
if let Some(session) = self.session() {
client.base_client().set_session_meta(session.into_meta()).await?;
client.set_session_meta(session.into_meta()).await?;
}
Ok(client)
+1 -1
View File
@@ -825,7 +825,7 @@ impl MatrixAuth {
async fn set_session(&self, session: MatrixSession) -> Result<()> {
self.set_session_tokens(session.tokens);
self.client.base_client().set_session_meta(session.meta).await?;
self.client.set_session_meta(session.meta).await?;
Ok(())
}
+2 -2
View File
@@ -712,7 +712,7 @@ impl Oidc {
authorization_data: Default::default(),
};
self.client.base_client().set_session_meta(meta).await?;
self.client.set_session_meta(meta).await?;
self.deferred_enable_cross_process_refresh_lock().await?;
self.client
@@ -911,7 +911,7 @@ impl Oidc {
device_id: whoami_res.device_id.ok_or(OidcError::MissingDeviceId)?,
};
self.client.base_client().set_session_meta(session).await.map_err(crate::Error::from)?;
self.client.set_session_meta(session).await.map_err(crate::Error::from)?;
// At this point the Olm machine has been set up.
// Enable the cross-process lock for refreshes, if needs be.