From e271b17766071161e165a0531033ef47b3a1d258 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Wed, 11 Mar 2020 11:43:58 +0100 Subject: [PATCH] async_client: Upload encryption keys in the sync_forever method. --- src/async_client.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/async_client.rs b/src/async_client.rs index b375f8d2..8dc8b1fd 100644 --- a/src/async_client.rs +++ b/src/async_client.rs @@ -491,10 +491,6 @@ impl AsyncClient { loop { let response = self.sync(sync_settings.clone()).await; - // TODO query keys here. - // TODO upload keys here - // TODO send out to-device messages here - let response = if let Ok(r) = response { r } else { @@ -504,6 +500,16 @@ impl AsyncClient { callback(response).await; + // TODO query keys here. + // TODO send out to-device messages here + + #[cfg(feature = "encryption")] + { + if self.base_client.read().await.should_upload_keys().await { + let _ = self.keys_upload().await; + } + } + let now = Instant::now(); // If the last sync happened less than a second ago, sleep for a