Add ConnectionStateManager.
This commit is contained in:
parent
05325437e8
commit
7ce682984c
@ -361,6 +361,7 @@ set(TDLIB_SOURCE_PART1
|
||||
td/telegram/CommonDialogManager.cpp
|
||||
td/telegram/ConfigManager.cpp
|
||||
td/telegram/ConnectionState.cpp
|
||||
td/telegram/ConnectionStateManager.cpp
|
||||
td/telegram/Contact.cpp
|
||||
td/telegram/CountryInfoManager.cpp
|
||||
td/telegram/DelayDispatcher.cpp
|
||||
@ -650,6 +651,7 @@ set(TDLIB_SOURCE_PART2
|
||||
td/telegram/CommonDialogManager.h
|
||||
td/telegram/ConfigManager.h
|
||||
td/telegram/ConnectionState.h
|
||||
td/telegram/ConnectionStateManager.h
|
||||
td/telegram/Contact.h
|
||||
td/telegram/CountryInfoManager.h
|
||||
td/telegram/CustomEmojiId.h
|
||||
|
@ -329,6 +329,7 @@ function split_file($file, $chunks, $undo) {
|
||||
'ChatId' => 'ChatId',
|
||||
'chat_manager[_(-](?![.]get[(][)])|ChatManager([^ ;.]| [^*])' => 'ChatManager',
|
||||
'common_dialog_manager[_(-](?![.]get[(][)])|CommonDialogManager' => 'CommonDialogManager',
|
||||
'connection_state_manager[_(-](?![.]get[(][)])|ConnectionStateManager' => 'ConnectionStateManager',
|
||||
'country_info_manager[_(-](?![.]get[(][)])|CountryInfoManager' => 'CountryInfoManager',
|
||||
'CustomEmojiId' => 'CustomEmojiId',
|
||||
'device_token_manager[_(-](?![.]get[(][)])|DeviceTokenManager' => 'DeviceTokenManager',
|
||||
|
18
td/telegram/ConnectionStateManager.cpp
Normal file
18
td/telegram/ConnectionStateManager.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
//
|
||||
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2024
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
#include "td/telegram/ConnectionStateManager.h"
|
||||
|
||||
namespace td {
|
||||
|
||||
ConnectionStateManager::ConnectionStateManager(Td *td, ActorShared<> parent) : td_(td), parent_(std::move(parent)) {
|
||||
}
|
||||
|
||||
void ConnectionStateManager::tear_down() {
|
||||
parent_.reset();
|
||||
}
|
||||
|
||||
} // namespace td
|
28
td/telegram/ConnectionStateManager.h
Normal file
28
td/telegram/ConnectionStateManager.h
Normal file
@ -0,0 +1,28 @@
|
||||
//
|
||||
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2024
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
#pragma once
|
||||
|
||||
#include "td/actor/actor.h"
|
||||
|
||||
#include "td/utils/common.h"
|
||||
|
||||
namespace td {
|
||||
|
||||
class Td;
|
||||
|
||||
class ConnectionStateManager final : public Actor {
|
||||
public:
|
||||
ConnectionStateManager(Td *td, ActorShared<> parent);
|
||||
|
||||
private:
|
||||
void tear_down() final;
|
||||
|
||||
Td *td_;
|
||||
ActorShared<> parent_;
|
||||
};
|
||||
|
||||
} // namespace td
|
@ -40,6 +40,7 @@
|
||||
#include "td/telegram/ChatManager.h"
|
||||
#include "td/telegram/CommonDialogManager.h"
|
||||
#include "td/telegram/ConfigManager.h"
|
||||
#include "td/telegram/ConnectionStateManager.h"
|
||||
#include "td/telegram/CountryInfoManager.h"
|
||||
#include "td/telegram/CustomEmojiId.h"
|
||||
#include "td/telegram/DeviceTokenManager.h"
|
||||
@ -2685,8 +2686,9 @@ void Td::dec_actor_refcnt() {
|
||||
reset_manager(business_manager_, "BusinessManager");
|
||||
reset_manager(callback_queries_manager_, "CallbackQueriesManager");
|
||||
reset_manager(channel_recommendation_manager_, "ChannelRecommendationManager");
|
||||
reset_manager(common_dialog_manager_, "CommonDialogManager");
|
||||
reset_manager(chat_manager_, "ChatManager");
|
||||
reset_manager(common_dialog_manager_, "CommonDialogManager");
|
||||
reset_manager(connection_state_manager_, "ConnectionStateManager");
|
||||
reset_manager(country_info_manager_, "CountryInfoManager");
|
||||
reset_manager(dialog_action_manager_, "DialogActionManager");
|
||||
reset_manager(dialog_filter_manager_, "DialogFilterManager");
|
||||
@ -2864,8 +2866,9 @@ void Td::clear() {
|
||||
reset_actor(ActorOwn<Actor>(std::move(business_connection_manager_actor_)));
|
||||
reset_actor(ActorOwn<Actor>(std::move(business_manager_actor_)));
|
||||
reset_actor(ActorOwn<Actor>(std::move(channel_recommendation_manager_actor_)));
|
||||
reset_actor(ActorOwn<Actor>(std::move(common_dialog_manager_actor_)));
|
||||
reset_actor(ActorOwn<Actor>(std::move(chat_manager_actor_)));
|
||||
reset_actor(ActorOwn<Actor>(std::move(common_dialog_manager_actor_)));
|
||||
reset_actor(ActorOwn<Actor>(std::move(connection_state_manager_actor_)));
|
||||
reset_actor(ActorOwn<Actor>(std::move(country_info_manager_actor_)));
|
||||
reset_actor(ActorOwn<Actor>(std::move(dialog_action_manager_actor_)));
|
||||
reset_actor(ActorOwn<Actor>(std::move(dialog_filter_manager_actor_)));
|
||||
@ -3369,11 +3372,13 @@ void Td::init_managers() {
|
||||
channel_recommendation_manager_ = make_unique<ChannelRecommendationManager>(this, create_reference());
|
||||
channel_recommendation_manager_actor_ =
|
||||
register_actor("ChannelRecommendationManager", channel_recommendation_manager_.get());
|
||||
common_dialog_manager_ = make_unique<CommonDialogManager>(this, create_reference());
|
||||
common_dialog_manager_actor_ = register_actor("CommonDialogManager", common_dialog_manager_.get());
|
||||
chat_manager_ = make_unique<ChatManager>(this, create_reference());
|
||||
chat_manager_actor_ = register_actor("ChatManager", chat_manager_.get());
|
||||
G()->set_chat_manager(chat_manager_actor_.get());
|
||||
common_dialog_manager_ = make_unique<CommonDialogManager>(this, create_reference());
|
||||
common_dialog_manager_actor_ = register_actor("CommonDialogManager", common_dialog_manager_.get());
|
||||
connection_state_manager_ = make_unique<ConnectionStateManager>(this, create_reference());
|
||||
connection_state_manager_actor_ = register_actor("ConnectionStateManager", connection_state_manager_.get());
|
||||
country_info_manager_ = make_unique<CountryInfoManager>(this, create_reference());
|
||||
country_info_manager_actor_ = register_actor("CountryInfoManager", country_info_manager_.get());
|
||||
dialog_action_manager_ = make_unique<DialogActionManager>(this, create_reference());
|
||||
|
@ -51,6 +51,7 @@ class ChannelRecommendationManager;
|
||||
class ChatManager;
|
||||
class CommonDialogManager;
|
||||
class ConfigManager;
|
||||
class ConnectionStateManager;
|
||||
class CountryInfoManager;
|
||||
class DeviceTokenManager;
|
||||
class DialogActionManager;
|
||||
@ -189,6 +190,8 @@ class Td final : public Actor {
|
||||
ActorOwn<ChatManager> chat_manager_actor_;
|
||||
unique_ptr<CommonDialogManager> common_dialog_manager_;
|
||||
ActorOwn<CommonDialogManager> common_dialog_manager_actor_;
|
||||
unique_ptr<ConnectionStateManager> connection_state_manager_;
|
||||
ActorOwn<ConnectionStateManager> connection_state_manager_actor_;
|
||||
unique_ptr<CountryInfoManager> country_info_manager_;
|
||||
ActorOwn<CountryInfoManager> country_info_manager_actor_;
|
||||
unique_ptr<DialogActionManager> dialog_action_manager_;
|
||||
|
Loading…
Reference in New Issue
Block a user