Fix request key loops

This commit is contained in:
Nicolas Werner 2021-01-27 20:29:06 +01:00
parent 73244afdb8
commit 5fbf17f6ec

View file

@ -242,7 +242,9 @@ EventStore::receivedSessionKey(const std::string &session_id)
return; return;
auto request = pending_key_requests.at(session_id); auto request = pending_key_requests.at(session_id);
pending_key_requests.erase(session_id);
// Don't request keys again until Nheko is restarted (for now)
pending_key_requests[session_id].events.clear();
olm::send_key_request_for(request.events.front(), request.request_id, true); olm::send_key_request_for(request.events.front(), request.request_id, true);
@ -778,7 +780,8 @@ EventStore::fetchMore()
if (cache::client()->previousBatchToken(room_id_) != opts.from) { if (cache::client()->previousBatchToken(room_id_) != opts.from) {
nhlog::net()->warn("Cache cleared while fetching more messages, dropping " nhlog::net()->warn("Cache cleared while fetching more messages, dropping "
"/messages response"); "/messages response");
emit fetchedMore(); if (!opts.to.empty())
emit fetchedMore();
return; return;
} }
if (err) { if (err) {