Improve names of create_*_storer functions.
This commit is contained in:
parent
254a3bfef0
commit
14af252795
@ -149,7 +149,7 @@ class QueryImpl {
|
||||
Slice data = query_.packet.as_slice();
|
||||
mtproto_api::gzip_packed packed(data);
|
||||
auto plain_storer = create_storer(data);
|
||||
auto gzip_storer = create_storer(packed);
|
||||
auto gzip_storer = create_object_storer(packed);
|
||||
const Storer &data_storer =
|
||||
query_.gzip_flag ? static_cast<const Storer &>(gzip_storer) : static_cast<const Storer &>(plain_storer);
|
||||
auto header_storer = create_storer(header_);
|
||||
|
@ -74,7 +74,7 @@ void AuthKeyHandshake::on_finish() {
|
||||
}
|
||||
|
||||
string AuthKeyHandshake::store_object(const mtproto_api::Object &object) {
|
||||
auto storer = create_storer(object);
|
||||
auto storer = create_object_storer(object);
|
||||
size_t size = storer.size();
|
||||
string result(size, '\0');
|
||||
auto real_size = storer.store(MutableSlice(result).ubegin());
|
||||
@ -154,8 +154,7 @@ Status AuthKeyHandshake::on_res_pq(Slice message, Callback *connection, PublicRs
|
||||
}
|
||||
|
||||
mtproto_api::req_DH_params req_dh_params(nonce_, server_nonce_, p, q, rsa_key.fingerprint, encrypted_data);
|
||||
|
||||
send(connection, create_storer(req_dh_params));
|
||||
send(connection, create_function_storer(req_dh_params));
|
||||
state_ = ServerDHParams;
|
||||
return Status::OK();
|
||||
}
|
||||
@ -240,7 +239,7 @@ Status AuthKeyHandshake::on_server_dh_params(Slice message, Callback *connection
|
||||
aes_ige_encrypt(as_slice(tmp_aes_key), as_mutable_slice(tmp_aes_iv), encrypted_data, encrypted_data);
|
||||
|
||||
mtproto_api::set_client_DH_params set_client_dh_params(nonce_, server_nonce_, encrypted_data);
|
||||
send(connection, create_storer(set_client_dh_params));
|
||||
send(connection, create_function_storer(set_client_dh_params));
|
||||
|
||||
auth_key_ = AuthKey(auth_key_params.first, std::move(auth_key_params.second));
|
||||
if (mode_ == Mode::Temp) {
|
||||
@ -319,7 +318,7 @@ Status AuthKeyHandshake::on_start(Callback *connection) {
|
||||
return Status::Error(PSLICE() << "on_start called after start " << tag("state", state_));
|
||||
}
|
||||
Random::secure_bytes(nonce_.raw, sizeof(nonce_));
|
||||
send(connection, create_storer(mtproto_api::req_pq_multi(nonce_)));
|
||||
send(connection, create_function_storer(mtproto_api::req_pq_multi(nonce_)));
|
||||
state_ = ResPQ;
|
||||
|
||||
return Status::OK();
|
||||
|
@ -48,8 +48,8 @@ class PingConnectionReqPQ final
|
||||
if (!was_ping_) {
|
||||
UInt128 nonce;
|
||||
Random::secure_bytes(nonce.raw, sizeof(nonce));
|
||||
raw_connection_->send_no_crypto(PacketStorer<NoCryptoImpl>(MessageId(static_cast<uint64>(1)),
|
||||
create_storer(mtproto_api::req_pq_multi(nonce))));
|
||||
raw_connection_->send_no_crypto(PacketStorer<NoCryptoImpl>(
|
||||
MessageId(static_cast<uint64>(1)), create_function_storer(mtproto_api::req_pq_multi(nonce))));
|
||||
was_ping_ = true;
|
||||
if (ping_count_ == 1) {
|
||||
start_time_ = Time::now();
|
||||
|
@ -842,7 +842,7 @@ std::pair<MessageId, BufferSlice> SessionConnection::encrypted_bind(int64 perm_k
|
||||
int64 temp_key = auth_data_->get_tmp_auth_key().id();
|
||||
|
||||
mtproto_api::bind_auth_key_inner object(nonce, temp_key, perm_key, auth_data_->get_session_id(), expires_at);
|
||||
auto object_storer = create_storer(object);
|
||||
auto object_storer = create_object_storer(object);
|
||||
auto size = object_storer.size();
|
||||
auto object_packet = BufferWriter{size, 0, 0};
|
||||
auto real_size = object_storer.store(object_packet.as_mutable_slice().ubegin());
|
||||
|
@ -11,11 +11,11 @@
|
||||
namespace td {
|
||||
namespace mtproto {
|
||||
|
||||
TLStorer<mtproto_api::Function> create_storer(const mtproto_api::Function &function) {
|
||||
TLStorer<mtproto_api::Function> create_function_storer(const mtproto_api::Function &function) {
|
||||
return TLStorer<mtproto_api::Function>(function);
|
||||
}
|
||||
|
||||
TLObjectStorer<mtproto_api::Object> create_storer(const mtproto_api::Object &object) {
|
||||
TLObjectStorer<mtproto_api::Object> create_object_storer(const mtproto_api::Object &object) {
|
||||
return TLObjectStorer<mtproto_api::Object>(object);
|
||||
}
|
||||
|
||||
|
@ -50,9 +50,9 @@ class Function;
|
||||
|
||||
namespace mtproto {
|
||||
|
||||
TLStorer<mtproto_api::Function> create_storer(const mtproto_api::Function &function);
|
||||
TLStorer<mtproto_api::Function> create_function_storer(const mtproto_api::Function &function);
|
||||
|
||||
TLObjectStorer<mtproto_api::Object> create_storer(const mtproto_api::Object &object);
|
||||
TLObjectStorer<mtproto_api::Object> create_object_storer(const mtproto_api::Object &object);
|
||||
|
||||
} // namespace mtproto
|
||||
} // namespace td
|
||||
|
@ -45,7 +45,7 @@
|
||||
|
||||
namespace td {
|
||||
|
||||
inline TLObjectStorer<secret_api::Object> create_storer(const secret_api::Object &object) {
|
||||
inline TLObjectStorer<secret_api::Object> create_object_storer(const secret_api::Object &object) {
|
||||
return TLObjectStorer<secret_api::Object>(object);
|
||||
}
|
||||
|
||||
@ -221,7 +221,7 @@ Result<BufferSlice> SecretChatActor::create_encrypted_message(int32 my_in_seq_no
|
||||
auto message_with_layer = secret_api::make_object<secret_api::decryptedMessageLayer>(
|
||||
std::move(random_bytes), layer, in_seq_no, out_seq_no, std::move(message));
|
||||
LOG(INFO) << "Create message " << to_string(message_with_layer);
|
||||
auto storer = create_storer(*message_with_layer);
|
||||
auto storer = create_object_storer(*message_with_layer);
|
||||
auto new_storer = mtproto::PacketStorer<SecretImpl>(storer);
|
||||
mtproto::PacketInfo packet_info;
|
||||
packet_info.type = mtproto::PacketInfo::EndToEnd;
|
||||
|
Loading…
Reference in New Issue
Block a user