Skip to content

Commit

Permalink
Improve NetQueryCreator constructor.
Browse files Browse the repository at this point in the history
  • Loading branch information
levlam committed Oct 6, 2021
1 parent bbae7be commit a160241
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions td/telegram/Global.h
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
5 changes: 5 additions & 0 deletions td/telegram/net/NetQueryCreator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
5 changes: 1 addition & 4 deletions td/telegram/net/NetQueryCreator.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion test/secret.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit a160241

Please sign in to comment.