diff --git a/td/telegram/ConfigManager.cpp b/td/telegram/ConfigManager.cpp index dcd5e602..81158d7f 100644 --- a/td/telegram/ConfigManager.cpp +++ b/td/telegram/ConfigManager.cpp @@ -505,8 +505,8 @@ ActorOwn<> get_full_config(DcOption option, Promise promise, ActorSh false /*need_destroy_auth_key*/, mtproto::AuthKey(), std::vector()); auto query = G()->net_query_creator().create(create_storer(telegram_api::help_getConfig()), DcId::empty(), - NetQuery::Type::Common, NetQuery::AuthFlag::Off, - NetQuery::GzipFlag::On, 60 * 60 * 24); + NetQuery::Type::Common, NetQuery::AuthFlag::Off); + query->total_timeout_limit = 60 * 60 * 24; query->set_callback(actor_shared(this)); query->dispatch_ttl = 0; send_closure(session_, &Session::send, std::move(query)); @@ -932,11 +932,10 @@ void ConfigManager::get_app_config(Promise get_app_config_queries_.push_back(std::move(promise)); if (get_app_config_queries_.size() == 1) { - G()->net_query_dispatcher().dispatch_with_callback( - G()->net_query_creator().create(create_storer(telegram_api::help_getAppConfig()), DcId::main(), - NetQuery::Type::Common, NetQuery::AuthFlag::Off, NetQuery::GzipFlag::On, - 60 * 60 * 24), - actor_shared(this, 1)); + auto query = G()->net_query_creator().create(create_storer(telegram_api::help_getAppConfig()), DcId::main(), + NetQuery::Type::Common, NetQuery::AuthFlag::Off); + query->total_timeout_limit = 60 * 60 * 24; + G()->net_query_dispatcher().dispatch_with_callback(std::move(query), actor_shared(this, 1)); } } @@ -992,10 +991,10 @@ void ConfigManager::on_dc_options_update(DcOptions dc_options) { void ConfigManager::request_config_from_dc_impl(DcId dc_id) { config_sent_cnt_++; - G()->net_query_dispatcher().dispatch_with_callback( - G()->net_query_creator().create(create_storer(telegram_api::help_getConfig()), dc_id, NetQuery::Type::Common, - NetQuery::AuthFlag::Off, NetQuery::GzipFlag::On, 60 * 60 * 24), - actor_shared(this, 0)); + auto query = G()->net_query_creator().create(create_storer(telegram_api::help_getConfig()), dc_id, + NetQuery::Type::Common, NetQuery::AuthFlag::Off); + query->total_timeout_limit = 60 * 60 * 24; + G()->net_query_dispatcher().dispatch_with_callback(std::move(query), actor_shared(this, 0)); } void ConfigManager::set_ignore_sensitive_content_restrictions(bool ignore_sensitive_content_restrictions) { diff --git a/td/telegram/net/DcAuthManager.cpp b/td/telegram/net/DcAuthManager.cpp index 85fd52b6..57b507dd 100644 --- a/td/telegram/net/DcAuthManager.cpp +++ b/td/telegram/net/DcAuthManager.cpp @@ -171,11 +171,10 @@ void DcAuthManager::dc_loop(DcInfo &dc) { // send auth.exportAuthorization to auth_dc VLOG(dc) << "Send exportAuthorization to " << dc.dc_id; auto id = UniqueId::next(); - G()->net_query_dispatcher().dispatch_with_callback( - G()->net_query_creator().create( - id, create_storer(telegram_api::auth_exportAuthorization(dc.dc_id.get_raw_id())), DcId::main(), - NetQuery::Type::Common, NetQuery::AuthFlag::On, NetQuery::GzipFlag::On, 60 * 60 * 24), - actor_shared(this, dc.dc_id.get_raw_id())); + auto query = G()->net_query_creator().create( + id, create_storer(telegram_api::auth_exportAuthorization(dc.dc_id.get_raw_id()))); + query->total_timeout_limit = 60 * 60 * 24; + G()->net_query_dispatcher().dispatch_with_callback(std::move(query), actor_shared(this, dc.dc_id.get_raw_id())); dc.wait_id = id; dc.export_id = -1; dc.state = DcInfo::State::Import; @@ -188,21 +187,19 @@ void DcAuthManager::dc_loop(DcInfo &dc) { } uint64 id = UniqueId::next(); VLOG(dc) << "Send importAuthorization to " << dc.dc_id; - G()->net_query_dispatcher().dispatch_with_callback( - G()->net_query_creator().create( - id, create_storer(telegram_api::auth_importAuthorization(dc.export_id, std::move(dc.export_bytes))), - dc.dc_id, NetQuery::Type::Common, NetQuery::AuthFlag::Off, NetQuery::GzipFlag::On, 60 * 60 * 24), - actor_shared(this, dc.dc_id.get_raw_id())); + auto query = G()->net_query_creator().create( + id, create_storer(telegram_api::auth_importAuthorization(dc.export_id, std::move(dc.export_bytes))), dc.dc_id, + NetQuery::Type::Common, NetQuery::AuthFlag::Off); + query->total_timeout_limit = 60 * 60 * 24; + G()->net_query_dispatcher().dispatch_with_callback(std::move(query), actor_shared(this, dc.dc_id.get_raw_id())); dc.wait_id = id; dc.state = DcInfo::State::BeforeOk; break; } - case DcInfo::State::BeforeOk: { + case DcInfo::State::BeforeOk: break; - } - case DcInfo::State::Ok: { + case DcInfo::State::Ok: break; - } } } diff --git a/td/telegram/net/NetQueryCreator.cpp b/td/telegram/net/NetQueryCreator.cpp index 3777a6f8..ba48f9db 100644 --- a/td/telegram/net/NetQueryCreator.cpp +++ b/td/telegram/net/NetQueryCreator.cpp @@ -14,8 +14,7 @@ namespace td { NetQueryCreator::Ptr NetQueryCreator::create(uint64 id, const Storer &storer, DcId dc_id, NetQuery::Type type, - NetQuery::AuthFlag auth_flag, NetQuery::GzipFlag gzip_flag, - double total_timeout_limit) { + NetQuery::AuthFlag auth_flag, NetQuery::GzipFlag gzip_flag) { BufferSlice slice(storer.size()); auto real_size = storer.store(slice.as_slice().ubegin()); LOG_CHECK(real_size == slice.size()) << real_size << " " << slice.size() << " " @@ -39,7 +38,6 @@ NetQueryCreator::Ptr NetQueryCreator::create(uint64 id, const Storer &storer, Dc auto query = object_pool_.create(NetQuery::State::Query, id, std::move(slice), BufferSlice(), dc_id, type, auth_flag, gzip_flag, tl_constructor); query->set_cancellation_token(query.generation()); - query->total_timeout_limit = total_timeout_limit; return query; } diff --git a/td/telegram/net/NetQueryCreator.h b/td/telegram/net/NetQueryCreator.h index db5c1b40..353eebe3 100644 --- a/td/telegram/net/NetQueryCreator.h +++ b/td/telegram/net/NetQueryCreator.h @@ -36,12 +36,12 @@ class NetQueryCreator { Ptr create(const Storer &storer, DcId dc_id = DcId::main(), NetQuery::Type type = NetQuery::Type::Common, NetQuery::AuthFlag auth_flag = NetQuery::AuthFlag::On, - NetQuery::GzipFlag gzip_flag = NetQuery::GzipFlag::On, double total_timeout_limit = 60) { - return create(UniqueId::next(), storer, dc_id, type, auth_flag, gzip_flag, total_timeout_limit); + NetQuery::GzipFlag gzip_flag = NetQuery::GzipFlag::On) { + return create(UniqueId::next(), storer, dc_id, type, auth_flag, gzip_flag); } Ptr create(uint64 id, const Storer &storer, DcId dc_id = DcId::main(), NetQuery::Type type = NetQuery::Type::Common, NetQuery::AuthFlag auth_flag = NetQuery::AuthFlag::On, - NetQuery::GzipFlag gzip_flag = NetQuery::GzipFlag::On, double total_timeout_limit = 60); + NetQuery::GzipFlag gzip_flag = NetQuery::GzipFlag::On); private: ObjectPool object_pool_; diff --git a/td/telegram/net/PublicRsaKeyWatchdog.cpp b/td/telegram/net/PublicRsaKeyWatchdog.cpp index bf78411d..f49c0cc9 100644 --- a/td/telegram/net/PublicRsaKeyWatchdog.cpp +++ b/td/telegram/net/PublicRsaKeyWatchdog.cpp @@ -68,11 +68,9 @@ void PublicRsaKeyWatchdog::loop() { } flood_control_.add_event(static_cast(Time::now_cached())); has_query_ = true; - G()->net_query_dispatcher().dispatch_with_callback( - G()->net_query_creator().create(create_storer(telegram_api::help_getCdnConfig()), DcId::main(), - NetQuery::Type::Common, NetQuery::AuthFlag::On, NetQuery::GzipFlag::On, - 60 * 60 * 24), - actor_shared(this)); + auto query = G()->net_query_creator().create(create_storer(telegram_api::help_getCdnConfig())); + query->total_timeout_limit = 60 * 60 * 24; + G()->net_query_dispatcher().dispatch_with_callback(std::move(query), actor_shared(this)); } void PublicRsaKeyWatchdog::on_result(NetQueryPtr net_query) {