Fix updateAuthorizationState on destroy.

GitOrigin-RevId: 584e09935420af73d049a7f9ca669a16f2205304
This commit is contained in:
levlam 2018-12-26 22:04:46 +03:00
parent eba52ebdad
commit 8eb396ae87
3 changed files with 8 additions and 4 deletions

View File

@ -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) {

View File

@ -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<td_api::AuthorizationState> get_current_authorization_state_object() const;

View File

@ -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.