Fix DcAuthManager::check_authorization_is_ok.

This commit is contained in:
levlam 2022-05-02 20:44:37 +03:00
parent 134b7e7d01
commit d6569d43fd
2 changed files with 6 additions and 4 deletions

View File

@ -232,20 +232,21 @@ void DcAuthManager::loop() {
}
auto main_dc = find_dc(main_dc_id_.get_raw_id());
if (!main_dc || main_dc->auth_key_state != AuthKeyState::OK) {
if (need_check_authorization_is_ok_) {
G()->shared_config().set_option_string("auth", "Authorization check failed in DcAuthManager");
}
VLOG(dc) << "Skip loop, because main DC is " << main_dc_id_ << ", main auth key state is "
<< (main_dc != nullptr ? main_dc->auth_key_state : AuthKeyState::Empty);
return;
}
need_check_authorization_is_ok_ = false;
for (auto &dc : dcs_) {
dc_loop(dc);
}
}
void DcAuthManager::check_authorization_is_ok() {
auto main_dc = find_dc(main_dc_id_.get_raw_id());
if (!main_dc || main_dc->auth_key_state != AuthKeyState::OK) {
G()->shared_config().set_option_string("auth", "Authorization check failed in DcAuthManager");
}
need_check_authorization_is_ok_ = true;
}
} // namespace td

View File

@ -50,6 +50,7 @@ class DcAuthManager final : public NetQueryCallback {
std::vector<DcInfo> dcs_;
DcId main_dc_id_;
bool need_check_authorization_is_ok_{false};
bool close_flag_{false};
Promise<> destroy_promise_;