diff --git a/td/telegram/AuthManager.cpp b/td/telegram/AuthManager.cpp index 35e3182e..6d4f2691 100644 --- a/td/telegram/AuthManager.cpp +++ b/td/telegram/AuthManager.cpp @@ -688,8 +688,12 @@ void AuthManager::delete_account(uint64 query_id, const string &reason) { DcId::main(), NetQuery::Type::Common, NetQuery::AuthFlag::Off)); } -void AuthManager::on_closing() { - update_state(State::Closing); +void AuthManager::on_closing(bool destroy_flag) { + if (destroy_flag) { + update_state(State::LoggingOut); + } else { + update_state(State::Closing); + } } void AuthManager::on_new_query(uint64 query_id) { diff --git a/td/telegram/AuthManager.h b/td/telegram/AuthManager.h index 1e8cccf8..02250bce 100644 --- a/td/telegram/AuthManager.h +++ b/td/telegram/AuthManager.h @@ -167,7 +167,7 @@ class AuthManager : public NetActor { void delete_account(uint64 query_id, const string &reason); void on_authorization_lost(); - void on_closing(); + void on_closing(bool destroy_flag); // can return nullptr if state isn't initialized yet tl_object_ptr get_current_authorization_state_object() const; diff --git a/td/telegram/Td.cpp b/td/telegram/Td.cpp index 1479fc9e..a01fa000 100644 --- a/td/telegram/Td.cpp +++ b/td/telegram/Td.cpp @@ -3911,7 +3911,7 @@ void Td::close_impl(bool destroy_flag) { state_ = State::Close; close_flag_ = 1; G()->set_close_flag(); - send_closure(auth_manager_actor_, &AuthManager::on_closing); + send_closure(auth_manager_actor_, &AuthManager::on_closing, destroy_flag); LOG(WARNING) << "Close " << tag("destroy", destroy_flag); // wait till all request_actors will stop.