Conduit does not send count, if it didn't change
This commit is contained in:
parent
8f1fa2ae4e
commit
e035d1407a
@ -939,33 +939,32 @@ ChatPage::currentPresence() const
|
|||||||
void
|
void
|
||||||
ChatPage::ensureOneTimeKeyCount(const std::map<std::string, uint16_t> &counts)
|
ChatPage::ensureOneTimeKeyCount(const std::map<std::string, uint16_t> &counts)
|
||||||
{
|
{
|
||||||
uint16_t count = 0;
|
if (auto count = counts.find(mtx::crypto::SIGNED_CURVE25519); c != counts.end()) {
|
||||||
if (auto c = counts.find(mtx::crypto::SIGNED_CURVE25519); c != counts.end())
|
if (count < MAX_ONETIME_KEYS) {
|
||||||
count = c->second;
|
const int nkeys = MAX_ONETIME_KEYS - count;
|
||||||
|
|
||||||
if (count < MAX_ONETIME_KEYS) {
|
nhlog::crypto()->info(
|
||||||
const int nkeys = MAX_ONETIME_KEYS - count;
|
"uploading {} {} keys", nkeys, mtx::crypto::SIGNED_CURVE25519);
|
||||||
|
olm::client()->generate_one_time_keys(nkeys);
|
||||||
|
|
||||||
nhlog::crypto()->info(
|
http::client()->upload_keys(
|
||||||
"uploading {} {} keys", nkeys, mtx::crypto::SIGNED_CURVE25519);
|
olm::client()->create_upload_keys_request(),
|
||||||
olm::client()->generate_one_time_keys(nkeys);
|
[](const mtx::responses::UploadKeys &, mtx::http::RequestErr err) {
|
||||||
|
if (err) {
|
||||||
|
nhlog::crypto()->warn(
|
||||||
|
"failed to update one-time keys: {} {} {}",
|
||||||
|
err->matrix_error.error,
|
||||||
|
static_cast<int>(err->status_code),
|
||||||
|
static_cast<int>(err->error_code));
|
||||||
|
|
||||||
http::client()->upload_keys(
|
if (err->status_code < 400 || err->status_code >= 500)
|
||||||
olm::client()->create_upload_keys_request(),
|
return;
|
||||||
[](const mtx::responses::UploadKeys &, mtx::http::RequestErr err) {
|
}
|
||||||
if (err) {
|
|
||||||
nhlog::crypto()->warn("failed to update one-time keys: {} {} {}",
|
|
||||||
err->matrix_error.error,
|
|
||||||
static_cast<int>(err->status_code),
|
|
||||||
static_cast<int>(err->error_code));
|
|
||||||
|
|
||||||
if (err->status_code < 400 || err->status_code >= 500)
|
// mark as published anyway, otherwise we may end up in a loop.
|
||||||
return;
|
olm::mark_keys_as_published();
|
||||||
}
|
});
|
||||||
|
}
|
||||||
// mark as published anyway, otherwise we may end up in a loop.
|
|
||||||
olm::mark_keys_as_published();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user