diff --git a/td/telegram/AuthManager.cpp b/td/telegram/AuthManager.cpp index c883ce789..fb34fb4dd 100644 --- a/td/telegram/AuthManager.cpp +++ b/td/telegram/AuthManager.cpp @@ -685,7 +685,7 @@ void AuthManager::on_log_out_result(NetQueryPtr &result) { } else { status = std::move(result->error()); } - LOG_IF(ERROR, status.is_error()) << "Receive error for auth.logOut: " << status; + LOG_IF(ERROR, status.is_error() && status.error().code() != 401) << "Receive error for auth.logOut: " << status; // state_ will stay LoggingOut, so no queries will work. destroy_auth_keys(); if (query_id_ != 0) { @@ -693,6 +693,10 @@ void AuthManager::on_log_out_result(NetQueryPtr &result) { } } void AuthManager::on_authorization_lost(string source) { + if (state_ == State::LoggingOut && net_query_type_ == NetQueryType::LogOut) { + LOG(INFO) << "Ignore authorization loss because of " << source << ", while logging out"; + return; + } LOG(WARNING) << "Lost authorization because of " << source; destroy_auth_keys(); } diff --git a/td/telegram/NotificationManager.cpp b/td/telegram/NotificationManager.cpp index f70c92f16..108dfd243 100644 --- a/td/telegram/NotificationManager.cpp +++ b/td/telegram/NotificationManager.cpp @@ -3052,7 +3052,7 @@ Status NotificationManager::process_push_notification_payload(string payload, bo if (loc_key == "SESSION_REVOKE") { if (was_encrypted) { - send_closure(td_->auth_manager_actor_, &AuthManager::on_authorization_lost, "SESSION_REVOKE"); + G()->log_out("SESSION_REVOKE"); } else { LOG(ERROR) << "Receive unencrypted SESSION_REVOKE push notification"; }