Add more checks for is_authorized.

This commit is contained in:
levlam 2023-08-17 00:32:29 +03:00
parent f0f1cc19ed
commit 203e8cf9c2
3 changed files with 13 additions and 7 deletions

View File

@ -181,7 +181,10 @@ void ReactionManager::tear_down() {
} }
void ReactionManager::init() { void ReactionManager::init() {
if (is_inited_ || !td_->auth_manager_->is_authorized() || td_->auth_manager_->is_bot() || G()->close_flag()) { if (G()->close_flag()) {
return;
}
if (is_inited_ || !td_->auth_manager_->is_authorized() || td_->auth_manager_->is_bot()) {
return; return;
} }
is_inited_ = true; is_inited_ = true;

View File

@ -1633,7 +1633,10 @@ void StickersManager::start_up() {
} }
void StickersManager::init() { void StickersManager::init() {
if (is_inited_ || !td_->auth_manager_->is_authorized() || td_->auth_manager_->is_bot() || G()->close_flag()) { if (G()->close_flag()) {
return;
}
if (is_inited_ || !td_->auth_manager_->is_authorized() || td_->auth_manager_->is_bot()) {
return; return;
} }
LOG(INFO) << "Init StickersManager"; LOG(INFO) << "Init StickersManager";

View File

@ -319,7 +319,7 @@ void UpdatesManager::check_pts_gap(void *td) {
} }
void UpdatesManager::repair_pts_gap() { void UpdatesManager::repair_pts_gap() {
if (running_get_difference_ || !postponed_pts_updates_.empty()) { if (!td_->auth_manager_->is_authorized() || running_get_difference_ || !postponed_pts_updates_.empty()) {
return; return;
} }
auto pts = get_pts() + 1; auto pts = get_pts() + 1;
@ -1771,10 +1771,10 @@ void UpdatesManager::on_server_pong(tl_object_ptr<telegram_api::updates_state> &
} }
void UpdatesManager::init_sessions(bool is_first) { void UpdatesManager::init_sessions(bool is_first) {
if (G()->close_flag()) { if (G()->close_flag() || !td_->auth_manager_->is_authorized()) {
return; return;
} }
if (are_sessions_inited_ == is_first || !td_->auth_manager_->is_authorized()) { if (are_sessions_inited_ == is_first) {
return; return;
} }
are_sessions_inited_ = true; are_sessions_inited_ = true;
@ -1870,7 +1870,7 @@ void UpdatesManager::process_get_difference_updates(
} }
void UpdatesManager::on_get_difference(tl_object_ptr<telegram_api::updates_Difference> &&difference_ptr) { void UpdatesManager::on_get_difference(tl_object_ptr<telegram_api::updates_Difference> &&difference_ptr) {
if (G()->close_flag()) { if (G()->close_flag() || !td_->auth_manager_->is_authorized()) {
return; return;
} }
@ -2020,7 +2020,7 @@ void UpdatesManager::on_get_difference(tl_object_ptr<telegram_api::updates_Diffe
void UpdatesManager::on_get_pts_update(int32 pts, void UpdatesManager::on_get_pts_update(int32 pts,
telegram_api::object_ptr<telegram_api::updates_Difference> difference_ptr) { telegram_api::object_ptr<telegram_api::updates_Difference> difference_ptr) {
if (G()->close_flag()) { if (G()->close_flag() || !td_->auth_manager_->is_authorized()) {
return; return;
} }
if (get_pts() != pts - 1 || running_get_difference_ || !postponed_pts_updates_.empty() || if (get_pts() != pts - 1 || running_get_difference_ || !postponed_pts_updates_.empty() ||