Ignore authorization loss errors while logging out.

This commit is contained in:
levlam 2022-06-20 17:43:08 +03:00
parent 49bd383b35
commit 21d8ba2f41
2 changed files with 6 additions and 2 deletions

View File

@ -685,7 +685,7 @@ void AuthManager::on_log_out_result(NetQueryPtr &result) {
} else { } else {
status = std::move(result->error()); 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. // state_ will stay LoggingOut, so no queries will work.
destroy_auth_keys(); destroy_auth_keys();
if (query_id_ != 0) { if (query_id_ != 0) {
@ -693,6 +693,10 @@ void AuthManager::on_log_out_result(NetQueryPtr &result) {
} }
} }
void AuthManager::on_authorization_lost(string source) { 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; LOG(WARNING) << "Lost authorization because of " << source;
destroy_auth_keys(); destroy_auth_keys();
} }

View File

@ -3052,7 +3052,7 @@ Status NotificationManager::process_push_notification_payload(string payload, bo
if (loc_key == "SESSION_REVOKE") { if (loc_key == "SESSION_REVOKE") {
if (was_encrypted) { if (was_encrypted) {
send_closure(td_->auth_manager_actor_, &AuthManager::on_authorization_lost, "SESSION_REVOKE"); G()->log_out("SESSION_REVOKE");
} else { } else {
LOG(ERROR) << "Receive unencrypted SESSION_REVOKE push notification"; LOG(ERROR) << "Receive unencrypted SESSION_REVOKE push notification";
} }