From 96fee8269932740e85f105dd607788211e0c8ebd Mon Sep 17 00:00:00 2001 From: levlam Date: Sat, 13 Jan 2024 00:59:17 +0300 Subject: [PATCH] Use separate initialization functions for different Manager types. --- SplitSource.php | 2 +- td/telegram/Td.cpp | 10 +++++++++- td/telegram/Td.h | 4 ++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/SplitSource.php b/SplitSource.php index c3b9f4e93..f99674762 100644 --- a/SplitSource.php +++ b/SplitSource.php @@ -170,7 +170,7 @@ function split_file($file, $chunks, $undo) { '(CREATE_REQUEST|CREATE_NO_ARGS_REQUEST)[(](?[A-Z][A-Za-z]*)|'. '(?complete_pending_preauthentication_requests)|'. '(?get_message_history_slice)|'. - '(Up|Down)load[a-zA-Z]*C(?allback)|(up|down)load_[a-z_]*_c(?allback)_|'. + '(Up|Down)load(?!ManagerCallback)[a-zA-Z]+C(?allback)|(up|down)load_[a-z_]*_c(?allback)_|'. '(?lazy_to_json)|'. '(?LogEvent)[^sA]|'. '(?parse)[(]|'. diff --git a/td/telegram/Td.cpp b/td/telegram/Td.cpp index 7eb59cec6..7eaaad2e9 100644 --- a/td/telegram/Td.cpp +++ b/td/telegram/Td.cpp @@ -3641,8 +3641,12 @@ void Td::init(Parameters parameters, Result r_opened_datab init_file_manager(); + init_non_actor_managers(); + init_managers(); + init_pure_actor_managers(); + secret_chats_manager_ = create_actor("SecretChatsManager", create_reference(), parameters.use_secret_chats_); G()->set_secret_chats_manager(secret_chats_manager_.get()); @@ -3865,13 +3869,15 @@ void Td::init_file_manager() { G()->set_file_reference_manager(file_reference_manager_actor_.get()); } -void Td::init_managers() { +void Td::init_non_actor_managers() { VLOG(td_init) << "Create Managers"; audios_manager_ = make_unique(this); callback_queries_manager_ = make_unique(this); documents_manager_ = make_unique(this); videos_manager_ = make_unique(this); +} +void Td::init_managers() { account_manager_ = make_unique(this, create_reference()); account_manager_actor_ = register_actor("AccountManager", account_manager_.get()); G()->set_account_manager(account_manager_actor_.get()); @@ -3983,7 +3989,9 @@ void Td::init_managers() { web_pages_manager_ = make_unique(this, create_reference()); web_pages_manager_actor_ = register_actor("WebPagesManager", web_pages_manager_.get()); G()->set_web_pages_manager(web_pages_manager_actor_.get()); +} +void Td::init_pure_actor_managers() { call_manager_ = create_actor("CallManager", create_reference()); G()->set_call_manager(call_manager_.get()); change_phone_number_manager_ = create_actor( diff --git a/td/telegram/Td.h b/td/telegram/Td.h index d8847675e..e738bc336 100644 --- a/td/telegram/Td.h +++ b/td/telegram/Td.h @@ -1833,8 +1833,12 @@ class Td final : public Actor { void init_file_manager(); + void init_non_actor_managers(); + void init_managers(); + void init_pure_actor_managers(); + void process_binlog_events(TdDb::OpenedDatabase &&events); void clear();