Replace NetQueryCreator.create_result with create_update.

GitOrigin-RevId: 21523bbd42a847b26359e49d6b70556599319121
This commit is contained in:
levlam 2020-03-15 01:24:11 +03:00
parent 7d71ec447a
commit a157cbf8d7
2 changed files with 7 additions and 14 deletions

View File

@ -29,16 +29,9 @@ class NetQueryCreator {
object_pool_.set_check_empty(false);
}
Ptr create_result(BufferSlice &&buffer, DcId dc_id = DcId::main(),
NetQuery::AuthFlag auth_flag = NetQuery::AuthFlag::On,
NetQuery::GzipFlag gzip_flag = NetQuery::GzipFlag::Off) {
return create_result(0, std::move(buffer), dc_id, auth_flag, gzip_flag);
}
Ptr create_result(uint64 id, BufferSlice &&buffer, DcId dc_id = DcId::main(),
NetQuery::AuthFlag auth_flag = NetQuery::AuthFlag::On,
NetQuery::GzipFlag gzip_flag = NetQuery::GzipFlag::Off) {
return object_pool_.create(NetQuery::State::OK, id, BufferSlice(), std::move(buffer), dc_id, NetQuery::Type::Common,
auth_flag, gzip_flag, 0);
Ptr create_update(BufferSlice &&buffer) {
return object_pool_.create(NetQuery::State::OK, 0, BufferSlice(), std::move(buffer), DcId::main(),
NetQuery::Type::Common, NetQuery::AuthFlag::On, NetQuery::GzipFlag::Off, 0);
}
Ptr create(const Storer &storer, DcId dc_id = DcId::main(), NetQuery::Type type = NetQuery::Type::Common,

View File

@ -540,12 +540,12 @@ void Session::on_session_created(uint64 unique_id, uint64 first_id) {
LOG(INFO) << "New session " << unique_id << " created with first message_id " << first_id;
if (is_main_) {
LOG(DEBUG) << "Sending updatesTooLong to force getDifference";
telegram_api::updatesTooLong too_long_;
auto storer = create_storer(too_long_);
telegram_api::updatesTooLong too_long;
auto storer = create_storer(too_long);
BufferSlice packet(storer.size());
auto real_size = storer.store(packet.as_slice().ubegin());
CHECK(real_size == packet.size());
return_query(G()->net_query_creator().create_result(0, std::move(packet)));
return_query(G()->net_query_creator().create_update(std::move(packet)));
}
for (auto it = sent_queries_.begin(); it != sent_queries_.end();) {
@ -682,7 +682,7 @@ Status Session::on_message_result_ok(uint64 id, BufferSlice packet, size_t origi
if (is_cdn_) {
return Status::Error("Got update from CDN connection");
}
return_query(G()->net_query_creator().create_result(0, std::move(packet)));
return_query(G()->net_query_creator().create_update(std::move(packet)));
return Status::OK();
}