Improve NetQueryCreator constructor.

This commit is contained in:
levlam 2021-10-06 18:47:32 +03:00
parent bbae7be409
commit a160241db7
4 changed files with 8 additions and 5 deletions

View File

@ -108,6 +108,7 @@ class Global final : public ActorContext {
}
void set_net_query_stats(std::shared_ptr<NetQueryStats> net_query_stats);
void set_net_query_dispatcher(unique_ptr<NetQueryDispatcher> net_query_dispatcher);
NetQueryDispatcher &net_query_dispatcher() {

View File

@ -20,6 +20,11 @@
namespace td {
NetQueryCreator::NetQueryCreator(std::shared_ptr<NetQueryStats> net_query_stats)
: net_query_stats_(std::move(net_query_stats)) {
object_pool_.set_check_empty(true);
}
NetQueryPtr NetQueryCreator::create(const telegram_api::Function &function, DcId dc_id, NetQuery::Type type) {
return create(UniqueId::next(), function, dc_id, type, NetQuery::AuthFlag::On);
}

View File

@ -23,10 +23,7 @@ class Function;
class NetQueryCreator {
public:
explicit NetQueryCreator(std::shared_ptr<NetQueryStats> net_query_stats = {}) {
net_query_stats_ = std::move(net_query_stats);
object_pool_.set_check_empty(true);
}
explicit NetQueryCreator(std::shared_ptr<NetQueryStats> net_query_stats);
void stop_check() {
object_pool_.set_check_empty(false);

View File

@ -562,7 +562,7 @@ class FakeSecretChatContext final : public SecretChatActor::Context {
std::shared_ptr<SecretChatDb> secret_chat_db_;
};
NetQueryCreator FakeSecretChatContext::net_query_creator_;
NetQueryCreator FakeSecretChatContext::net_query_creator_{nullptr};
class Master final : public Actor {
public: