From f424cb54f7c1c2f4f5d92d87fa93ff5d0e51f2d3 Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 19 Nov 2019 19:22:02 +0300 Subject: [PATCH] Create keys not simultaneously. --- .../mtproto/details/mtproto_dc_key_creator.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Telegram/SourceFiles/mtproto/details/mtproto_dc_key_creator.cpp b/Telegram/SourceFiles/mtproto/details/mtproto_dc_key_creator.cpp index 71f12b2ca..bf8fac938 100644 --- a/Telegram/SourceFiles/mtproto/details/mtproto_dc_key_creator.cpp +++ b/Telegram/SourceFiles/mtproto/details/mtproto_dc_key_creator.cpp @@ -183,9 +183,10 @@ DcKeyCreator::DcKeyCreator( answered(); }); - pqSend(&_temporary, _request.temporaryExpiresIn); if (_request.persistentNeeded) { pqSend(&_persistent, 0); + } else { + pqSend(&_temporary, _request.temporaryExpiresIn); } } @@ -602,13 +603,12 @@ void DcKeyCreator::failed(Error error) { } void DcKeyCreator::done() { - Expects(_temporary.stage != Stage::None); - - if (_persistent.stage != Stage::None && _persistent.stage != Stage::Ready) { - return; - } else if (_temporary.stage != Stage::Ready) { + if (_temporary.stage == Stage::None) { + pqSend(&_temporary, _request.temporaryExpiresIn); return; } + Assert(_temporary.stage == Stage::Ready); + Assert(_persistent.stage == Stage::Ready || _persistent.stage == Stage::None); auto result = Result(); result.temporaryKey = std::make_shared(