async_client: Upload encryption keys in the sync_forever method.

This commit is contained in:
Damir Jelić 2020-03-11 11:43:58 +01:00
parent 33ee5cce61
commit e271b17766

View file

@ -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