diff --git a/td/telegram/net/NetQueryDispatcher.cpp b/td/telegram/net/NetQueryDispatcher.cpp index 0d31a2574..3bec11b91 100644 --- a/td/telegram/net/NetQueryDispatcher.cpp +++ b/td/telegram/net/NetQueryDispatcher.cpp @@ -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(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)); diff --git a/td/telegram/net/SessionMultiProxy.cpp b/td/telegram/net/SessionMultiProxy.cpp index 75a12ef2f..d9368371a 100644 --- a/td/telegram/net/SessionMultiProxy.cpp +++ b/td/telegram/net/SessionMultiProxy.cpp @@ -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) { diff --git a/td/telegram/net/SessionMultiProxy.h b/td/telegram/net/SessionMultiProxy.h index 16f3f0426..9ce259013 100644 --- a/td/telegram/net/SessionMultiProxy.h +++ b/td/telegram/net/SessionMultiProxy.h @@ -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; diff --git a/td/telegram/net/SessionProxy.cpp b/td/telegram/net/SessionProxy.cpp index e46a609c0..701611b98 100644 --- a/td/telegram/net/SessionProxy.cpp +++ b/td/telegram/net/SessionProxy.cpp @@ -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(); } diff --git a/td/telegram/net/SessionProxy.h b/td/telegram/net/SessionProxy.h index af11c0158..c5b0b6686 100644 --- a/td/telegram/net/SessionProxy.h +++ b/td/telegram/net/SessionProxy.h @@ -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_;