Merge branch 'upload-keys'

master
Damir Jelić 2020-06-17 09:33:09 +02:00
commit ea427cf366
1 changed files with 6 additions and 0 deletions

View File

@ -215,6 +215,12 @@ impl OlmMachine {
match &self.uploaded_signed_key_count {
Some(count) => {
let max_keys = self.account.max_one_time_keys().await as u64;
// If there are more keys already uploaded than max_key / 2
// bail out returning false, this also avoids overflow.
if count.load(Ordering::Relaxed) > (max_keys / 2) {
return false;
}
let key_count = (max_keys / 2) - count.load(Ordering::Relaxed);
key_count > 0
}