Don't spam key requests directly after startup
This commit is contained in:
parent
eb6baf619a
commit
d30446a8b3
3 changed files with 23 additions and 0 deletions
|
|
@ -675,6 +675,9 @@ EventStore::decryptEvent(const IdIndex &idx,
|
|||
index.room_id,
|
||||
index.session_id,
|
||||
e.sender);
|
||||
// we may not want to request keys during initial sync and such
|
||||
if (suppressKeyRequests)
|
||||
break;
|
||||
// TODO: Check if this actually works and look in key backup
|
||||
auto copy = e;
|
||||
copy.room_id = room_id_;
|
||||
|
|
@ -816,6 +819,18 @@ EventStore::decryptEvent(const IdIndex &idx,
|
|||
return asCacheEntry(std::move(decryptionResult.event.value()));
|
||||
}
|
||||
|
||||
void
|
||||
EventStore::enableKeyRequests(bool suppressKeyRequests_)
|
||||
{
|
||||
if (!suppressKeyRequests_) {
|
||||
for (const auto &key : decryptedEvents_.keys())
|
||||
if (key.room == this->room_id_)
|
||||
decryptedEvents_.remove(key);
|
||||
suppressKeyRequests = false;
|
||||
} else
|
||||
suppressKeyRequests = true;
|
||||
}
|
||||
|
||||
mtx::events::collections::TimelineEvents *
|
||||
EventStore::get(std::string id, std::string_view related_to, bool decrypt, bool resolve_edits)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue