Support NetQueryCreator without Scheduler.

This commit is contained in:
levlam 2023-07-26 14:46:31 +03:00
parent 69c2315c10
commit 38fe2d7cb2

View File

@ -22,7 +22,8 @@
namespace td {
NetQueryCreator::NetQueryCreator(std::shared_ptr<NetQueryStats> net_query_stats)
: net_query_stats_(std::move(net_query_stats)), current_scheduler_id_(Scheduler::instance()->sched_id()) {
: net_query_stats_(std::move(net_query_stats))
, current_scheduler_id_(Scheduler::instance() == nullptr ? -2 : Scheduler::instance()->sched_id()) {
object_pool_.set_check_empty(true);
}
@ -44,7 +45,8 @@ NetQueryPtr NetQueryCreator::create(uint64 id, const telegram_api::Function &fun
int32 tl_constructor = function.get_id();
int32 total_timeout_limit = 60;
if (current_scheduler_id_ == Scheduler::instance()->sched_id() && !G()->close_flag()) {
if (Scheduler::instance() != nullptr && current_scheduler_id_ == Scheduler::instance()->sched_id() &&
!G()->close_flag()) {
auto td = G()->td();
if (!td.empty()) {
auto auth_manager = td.get_actor_unsafe()->auth_manager_.get();