async_client: Upload encryption keys in the sync_forever method.

master
Damir Jelić 2020-03-11 11:43:58 +01:00
parent 33ee5cce61
commit e271b17766
1 changed files with 10 additions and 4 deletions

View File

@ -491,10 +491,6 @@ impl AsyncClient {
loop { loop {
let response = self.sync(sync_settings.clone()).await; 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 { let response = if let Ok(r) = response {
r r
} else { } else {
@ -504,6 +500,16 @@ impl AsyncClient {
callback(response).await; 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(); let now = Instant::now();
// If the last sync happened less than a second ago, sleep for a // If the last sync happened less than a second ago, sleep for a