Fix error logging.

GitOrigin-RevId: d734897ab870154d47a3e576ba3cba8eb4d3156e
This commit is contained in:
levlam 2020-07-22 21:28:20 +03:00
parent 9ea1bc824f
commit fcd09d5c25
3 changed files with 8 additions and 3 deletions

View File

@ -84,8 +84,12 @@ 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 ||
state_ == State::Closing);
return is_bot_ && was_authorized();
}
bool AuthManager::was_authorized() const {
return state_ == State::Ok || state_ == State::LoggingOut || state_ == State::DestroyingKeys ||
state_ == State::Closing;
}
bool AuthManager::is_authorized() const {

View File

@ -30,6 +30,7 @@ class AuthManager : public NetActor {
bool is_bot() const;
bool is_authorized() const;
bool was_authorized() const;
void get_state(uint64 query_id);
void set_phone_number(uint64 query_id, string phone_number,

View File

@ -62,7 +62,7 @@ NetQueryPtr NetQueryCreator::create(uint64 id, const telegram_api::Function &fun
if (auth_manager != nullptr && auth_manager->is_bot()) {
total_timeout_limit = 8;
}
if ((auth_manager == nullptr || !auth_manager->is_authorized()) && auth_flag == NetQuery::AuthFlag::On) {
if ((auth_manager == nullptr || !auth_manager->was_authorized()) && auth_flag == NetQuery::AuthFlag::On) {
LOG(ERROR) << "Send query before authorization: " << to_string(function);
}
}