Make all fields required in full NetQueryCreator methos.
GitOrigin-RevId: aa8ebb5cc46b9f3b7c0b606c012ace5fafe2bbf2
This commit is contained in:
parent
0d08895871
commit
c4c9e51157
@ -71,7 +71,8 @@ SecretChatActor::SecretChatActor(int32 id, unique_ptr<Context> context, bool can
|
|||||||
template <class T>
|
template <class T>
|
||||||
NetQueryPtr SecretChatActor::create_net_query(QueryType type, const T &function) {
|
NetQueryPtr SecretChatActor::create_net_query(QueryType type, const T &function) {
|
||||||
return context_->net_query_creator().create(UniqueId::next(UniqueId::Type::Default, static_cast<uint8>(type)),
|
return context_->net_query_creator().create(UniqueId::next(UniqueId::Type::Default, static_cast<uint8>(type)),
|
||||||
create_storer(function));
|
create_storer(function), DcId::main(), NetQuery::Type::Common,
|
||||||
|
NetQuery::AuthFlag::On);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SecretChatActor::update_chat(telegram_api::object_ptr<telegram_api::EncryptedChat> chat) {
|
void SecretChatActor::update_chat(telegram_api::object_ptr<telegram_api::EncryptedChat> chat) {
|
||||||
|
@ -235,6 +235,7 @@ Result<std::pair<NetQueryPtr, bool>> FileDownloader::start_part(Part part, int32
|
|||||||
|
|
||||||
callback_->on_start_download();
|
callback_->on_start_download();
|
||||||
|
|
||||||
|
auto net_query_type = is_small_ ? NetQuery::Type::DownloadSmall : NetQuery::Type::Download;
|
||||||
NetQueryPtr net_query;
|
NetQueryPtr net_query;
|
||||||
if (!use_cdn_) {
|
if (!use_cdn_) {
|
||||||
int32 flags = 0;
|
int32 flags = 0;
|
||||||
@ -253,7 +254,7 @@ Result<std::pair<NetQueryPtr, bool>> FileDownloader::start_part(Part part, int32
|
|||||||
: create_storer(telegram_api::upload_getFile(flags, false /*ignored*/, false /*ignored*/,
|
: create_storer(telegram_api::upload_getFile(flags, false /*ignored*/, false /*ignored*/,
|
||||||
remote_.as_input_file_location(),
|
remote_.as_input_file_location(),
|
||||||
static_cast<int32>(part.offset), static_cast<int32>(size))),
|
static_cast<int32>(part.offset), static_cast<int32>(size))),
|
||||||
dc_id, is_small_ ? NetQuery::Type::DownloadSmall : NetQuery::Type::Download);
|
dc_id, net_query_type, NetQuery::AuthFlag::On);
|
||||||
} else {
|
} else {
|
||||||
if (remote_.is_web()) {
|
if (remote_.is_web()) {
|
||||||
return Status::Error("Can't download web file from CDN");
|
return Status::Error("Can't download web file from CDN");
|
||||||
@ -264,15 +265,15 @@ Result<std::pair<NetQueryPtr, bool>> FileDownloader::start_part(Part part, int32
|
|||||||
static_cast<int32>(size));
|
static_cast<int32>(size));
|
||||||
cdn_part_file_token_generation_[part.id] = cdn_file_token_generation_;
|
cdn_part_file_token_generation_[part.id] = cdn_file_token_generation_;
|
||||||
LOG(DEBUG) << part.id << " " << to_string(query);
|
LOG(DEBUG) << part.id << " " << to_string(query);
|
||||||
net_query = G()->net_query_creator().create(
|
net_query =
|
||||||
UniqueId::next(UniqueId::Type::Default, static_cast<uint8>(QueryType::CDN)), create_storer(query), cdn_dc_id_,
|
G()->net_query_creator().create(UniqueId::next(UniqueId::Type::Default, static_cast<uint8>(QueryType::CDN)),
|
||||||
is_small_ ? NetQuery::Type::DownloadSmall : NetQuery::Type::Download, NetQuery::AuthFlag::Off);
|
create_storer(query), cdn_dc_id_, net_query_type, NetQuery::AuthFlag::Off);
|
||||||
} else {
|
} else {
|
||||||
auto query = telegram_api::upload_reuploadCdnFile(BufferSlice(cdn_file_token_), BufferSlice(it->second));
|
auto query = telegram_api::upload_reuploadCdnFile(BufferSlice(cdn_file_token_), BufferSlice(it->second));
|
||||||
LOG(DEBUG) << part.id << " " << to_string(query);
|
LOG(DEBUG) << part.id << " " << to_string(query);
|
||||||
net_query = G()->net_query_creator().create(
|
net_query = G()->net_query_creator().create(
|
||||||
UniqueId::next(UniqueId::Type::Default, static_cast<uint8>(QueryType::ReuploadCDN)), create_storer(query),
|
UniqueId::next(UniqueId::Type::Default, static_cast<uint8>(QueryType::ReuploadCDN)), create_storer(query),
|
||||||
remote_.get_dc_id(), is_small_ ? NetQuery::Type::DownloadSmall : NetQuery::Type::Download);
|
remote_.get_dc_id(), net_query_type, NetQuery::AuthFlag::On);
|
||||||
cdn_part_reupload_token_.erase(it);
|
cdn_part_reupload_token_.erase(it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -464,9 +465,9 @@ Result<FileLoader::CheckInfo> FileDownloader::check_loop(int64 checked_prefix_si
|
|||||||
has_hash_query_ = true;
|
has_hash_query_ = true;
|
||||||
auto query =
|
auto query =
|
||||||
telegram_api::upload_getFileHashes(remote_.as_input_file_location(), narrow_cast<int32>(checked_prefix_size));
|
telegram_api::upload_getFileHashes(remote_.as_input_file_location(), narrow_cast<int32>(checked_prefix_size));
|
||||||
auto net_query =
|
auto net_query_type = is_small_ ? NetQuery::Type::DownloadSmall : NetQuery::Type::Download;
|
||||||
G()->net_query_creator().create(create_storer(query), remote_.get_dc_id(),
|
auto net_query = G()->net_query_creator().create(create_storer(query), remote_.get_dc_id(), net_query_type,
|
||||||
is_small_ ? NetQuery::Type::DownloadSmall : NetQuery::Type::Download);
|
NetQuery::AuthFlag::On);
|
||||||
info.queries.push_back(std::move(net_query));
|
info.queries.push_back(std::move(net_query));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -172,7 +172,8 @@ void DcAuthManager::dc_loop(DcInfo &dc) {
|
|||||||
VLOG(dc) << "Send exportAuthorization to " << dc.dc_id;
|
VLOG(dc) << "Send exportAuthorization to " << dc.dc_id;
|
||||||
auto id = UniqueId::next();
|
auto id = UniqueId::next();
|
||||||
auto query = G()->net_query_creator().create(
|
auto query = G()->net_query_creator().create(
|
||||||
id, create_storer(telegram_api::auth_exportAuthorization(dc.dc_id.get_raw_id())));
|
id, create_storer(telegram_api::auth_exportAuthorization(dc.dc_id.get_raw_id())), DcId::main(),
|
||||||
|
NetQuery::Type::Common, NetQuery::AuthFlag::On);
|
||||||
query->total_timeout_limit = 60 * 60 * 24;
|
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()));
|
G()->net_query_dispatcher().dispatch_with_callback(std::move(query), actor_shared(this, dc.dc_id.get_raw_id()));
|
||||||
dc.wait_id = id;
|
dc.wait_id = id;
|
||||||
|
@ -38,8 +38,8 @@ class NetQueryCreator {
|
|||||||
NetQuery::AuthFlag auth_flag = NetQuery::AuthFlag::On) {
|
NetQuery::AuthFlag auth_flag = NetQuery::AuthFlag::On) {
|
||||||
return create(UniqueId::next(), storer, dc_id, type, auth_flag);
|
return create(UniqueId::next(), storer, dc_id, type, auth_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);
|
Ptr create(uint64 id, const Storer &storer, DcId dc_id, NetQuery::Type type, NetQuery::AuthFlag auth_flag);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ObjectPool<NetQuery> object_pool_;
|
ObjectPool<NetQuery> object_pool_;
|
||||||
|
@ -1106,7 +1106,8 @@ bool Session::connection_send_check_main_key(ConnectionInfo *info) {
|
|||||||
being_checked_main_auth_key_id_ = key_id;
|
being_checked_main_auth_key_id_ = key_id;
|
||||||
last_check_query_id_ = UniqueId::next(UniqueId::BindKey);
|
last_check_query_id_ = UniqueId::next(UniqueId::BindKey);
|
||||||
NetQueryPtr query =
|
NetQueryPtr query =
|
||||||
G()->net_query_creator().create(last_check_query_id_, create_storer(telegram_api::help_getNearestDc()));
|
G()->net_query_creator().create(last_check_query_id_, create_storer(telegram_api::help_getNearestDc()),
|
||||||
|
DcId::main(), NetQuery::Type::Common, NetQuery::AuthFlag::On);
|
||||||
query->dispatch_ttl = 0;
|
query->dispatch_ttl = 0;
|
||||||
query->set_callback(actor_shared(this));
|
query->set_callback(actor_shared(this));
|
||||||
connection_send_query(info, std::move(query));
|
connection_send_query(info, std::move(query));
|
||||||
@ -1142,7 +1143,8 @@ bool Session::connection_send_bind_key(ConnectionInfo *info) {
|
|||||||
LOG(INFO) << "Bind key: " << tag("tmp", key_id) << tag("perm", static_cast<uint64>(perm_auth_key_id));
|
LOG(INFO) << "Bind key: " << tag("tmp", key_id) << tag("perm", static_cast<uint64>(perm_auth_key_id));
|
||||||
NetQueryPtr query = G()->net_query_creator().create(
|
NetQueryPtr query = G()->net_query_creator().create(
|
||||||
last_bind_query_id_,
|
last_bind_query_id_,
|
||||||
create_storer(telegram_api::auth_bindTempAuthKey(perm_auth_key_id, nonce, expires_at, std::move(encrypted))));
|
create_storer(telegram_api::auth_bindTempAuthKey(perm_auth_key_id, nonce, expires_at, std::move(encrypted))),
|
||||||
|
DcId::main(), NetQuery::Type::Common, NetQuery::AuthFlag::On);
|
||||||
query->dispatch_ttl = 0;
|
query->dispatch_ttl = 0;
|
||||||
query->set_callback(actor_shared(this));
|
query->set_callback(actor_shared(this));
|
||||||
connection_send_query(info, std::move(query), message_id);
|
connection_send_query(info, std::move(query), message_id);
|
||||||
|
Reference in New Issue
Block a user