Disallow unneeded canceling of destroy_auth_key.

This commit is contained in:
levlam 2023-10-23 14:00:22 +03:00
parent 8c10e893c0
commit 29d7916e4d
5 changed files with 13 additions and 11 deletions

View File

@ -240,8 +240,7 @@ void NetQueryDispatcher::destroy_auth_keys(Promise<> promise) {
need_destroy_auth_key_ = true;
for (size_t i = 1; i < MAX_DC_COUNT; i++) {
if (is_dc_inited(narrow_cast<int32>(i)) && dcs_[i - 1].id_.is_internal()) {
send_closure_later(dcs_[i - 1].main_session_, &SessionMultiProxy::update_destroy_auth_key,
need_destroy_auth_key_);
send_closure_later(dcs_[i - 1].main_session_, &SessionMultiProxy::destroy_auth_key);
}
}
send_closure_later(dc_auth_manager_, &DcAuthManager::destroy, std::move(promise));

View File

@ -61,9 +61,9 @@ void SessionMultiProxy::update_main_flag(bool is_main) {
}
}
void SessionMultiProxy::update_destroy_auth_key(bool need_destroy_auth_key) {
need_destroy_auth_key_ = need_destroy_auth_key;
send_closure(sessions_[0].proxy, &SessionProxy::update_destroy, need_destroy_auth_key_);
void SessionMultiProxy::destroy_auth_key() {
need_destroy_auth_key_ = true;
send_closure(sessions_[0].proxy, &SessionProxy::destroy_auth_key);
}
void SessionMultiProxy::update_session_count(int32 session_count) {

View File

@ -34,7 +34,7 @@ class SessionMultiProxy final : public Actor {
void update_options(int32 session_count, bool use_pfs);
void update_mtproto_header();
void update_destroy_auth_key(bool need_destroy_auth_key);
void destroy_auth_key();
private:
int32 session_count_ = 0;

View File

@ -172,12 +172,12 @@ void SessionProxy::update_main_flag(bool is_main) {
open_session();
}
void SessionProxy::update_destroy(bool need_destroy) {
if (need_destroy_ == need_destroy) {
LOG(INFO) << "Ignore reduntant update_destroy(" << need_destroy << ")";
void SessionProxy::destroy_auth_key() {
if (need_destroy_) {
LOG(INFO) << "Ignore reduntant destroy_auth_key";
return;
}
need_destroy_ = need_destroy;
need_destroy_ = true;
close_session();
open_session();
}

View File

@ -37,9 +37,12 @@ class SessionProxy final : public Actor {
bool need_destroy);
void send(NetQueryPtr query);
void update_main_flag(bool is_main);
void update_mtproto_header();
void update_destroy(bool need_destroy);
void destroy_auth_key();
private:
unique_ptr<Callback> callback_;