Remove total_timeout_limit parameter from NetQuery creator.

GitOrigin-RevId: 5c5a15654176061a64c0f167633a7842192200ba
This commit is contained in:
levlam 2020-03-15 01:44:21 +03:00
parent a157cbf8d7
commit b4138231ec
5 changed files with 28 additions and 36 deletions

View File

@ -505,8 +505,8 @@ ActorOwn<> get_full_config(DcOption option, Promise<FullConfig> promise, ActorSh
false /*need_destroy_auth_key*/, mtproto::AuthKey(),
std::vector<mtproto::ServerSalt>());
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<td_api::object_ptr<td_api::JsonValue>
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) {

View File

@ -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;
}
}
}

View File

@ -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;
}

View File

@ -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<NetQuery> object_pool_;

View File

@ -68,11 +68,9 @@ void PublicRsaKeyWatchdog::loop() {
}
flood_control_.add_event(static_cast<int32>(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) {