Better check for is_bot.

GitOrigin-RevId: a4dc6b4b2a38eb3474b2265af32b56f8500818df
This commit is contained in:
levlam 2020-01-05 15:24:37 +03:00
parent c25a346f54
commit 123361b26a
2 changed files with 4 additions and 1 deletions

View File

@ -79,6 +79,9 @@ void AuthManager::tear_down() {
} }
bool AuthManager::is_bot() const { bool AuthManager::is_bot() const {
if (net_query_id_ != 0 && net_query_type_ == NetQueryType::BotAuthentication) {
return true;
}
return is_bot_ && (state_ == State::Ok || state_ == State::LoggingOut || state_ == State::DestroyingKeys || return is_bot_ && (state_ == State::Ok || state_ == State::LoggingOut || state_ == State::DestroyingKeys ||
state_ == State::Closing); state_ == State::Closing);
} }

View File

@ -3338,7 +3338,7 @@ void Td::on_alarm_timeout(int64 alarm_id) {
} }
void Td::on_online_updated(bool force, bool send_update) { void Td::on_online_updated(bool force, bool send_update) {
if (close_flag_ >= 2 || auth_manager_->is_bot() || !auth_manager_->is_authorized()) { if (close_flag_ >= 2 || !auth_manager_->is_authorized() || auth_manager_->is_bot()) {
return; return;
} }
if (force || is_online_) { if (force || is_online_) {