Remove qts from logevent::InboundSecretMessage.

GitOrigin-RevId: ae90e87e3bd0291e78c56cfea161724882d76f1d
This commit is contained in:
levlam 2020-08-02 01:21:43 +03:00
parent 0ac58f7494
commit f1a23b9256
3 changed files with 15 additions and 14 deletions

View File

@ -261,7 +261,7 @@ void SecretChatsManager::on_update_message(tl_object_ptr<telegram_api::updateNew
}
auto event = make_unique<logevent::InboundSecretMessage>();
event->qts = qts;
event->qts_ack = add_qts(qts);
downcast_call(*update->message_, [&](auto &x) {
event->chat_id = x.chat_id_;
event->date = x.date_;
@ -324,14 +324,13 @@ void SecretChatsManager::binlog_replay_finish() {
}
void SecretChatsManager::replay_inbound_message(unique_ptr<logevent::InboundSecretMessage> message) {
LOG(INFO) << "Replay inbound secret message in chat " << message->chat_id << " with qts " << message->qts;
LOG(INFO) << "Replay inbound secret message in chat " << message->chat_id;
auto actor = get_chat_actor(message->chat_id);
send_closure_later(actor, &SecretChatActor::replay_inbound_message, std::move(message));
}
void SecretChatsManager::add_inbound_message(unique_ptr<logevent::InboundSecretMessage> message) {
LOG(INFO) << "Process inbound secret message in chat " << message->chat_id << " with qts " << message->qts;
message->qts_ack = add_qts(message->qts);
LOG(INFO) << "Process inbound secret message in chat " << message->chat_id;
auto actor = get_chat_actor(message->chat_id);
send_closure(actor, &SecretChatActor::add_inbound_message, std::move(message));

View File

@ -206,7 +206,6 @@ inline StringBuilder &operator<<(StringBuilder &sb, const EncryptedFileLocation
class InboundSecretMessage : public SecretChatLogEventBase<InboundSecretMessage> {
public:
static constexpr Type type = SecretChatEvent::Type::InboundSecretMessage;
int32 qts = 0;
int32 chat_id = 0;
int32 date = 0;
@ -240,9 +239,9 @@ class InboundSecretMessage : public SecretChatLogEventBase<InboundSecretMessage>
BEGIN_STORE_FLAGS();
STORE_FLAG(has_encrypted_file);
STORE_FLAG(is_pending);
STORE_FLAG(true);
END_STORE_FLAGS();
store(qts, storer);
store(chat_id, storer);
store(date, storer);
// skip encrypted_message
@ -265,12 +264,17 @@ class InboundSecretMessage : public SecretChatLogEventBase<InboundSecretMessage>
void parse(ParserT &parser) {
using td::parse;
bool no_qts;
BEGIN_PARSE_FLAGS();
PARSE_FLAG(has_encrypted_file);
PARSE_FLAG(is_pending);
PARSE_FLAG(no_qts);
END_PARSE_FLAGS();
parse(qts, parser);
if (!no_qts) {
int32 legacy_qts;
parse(legacy_qts, parser);
}
parse(chat_id, parser);
parse(date, parser);
// skip encrypted_message
@ -292,12 +296,11 @@ class InboundSecretMessage : public SecretChatLogEventBase<InboundSecretMessage>
}
StringBuilder &print(StringBuilder &sb) const override {
return sb << "[Logevent InboundSecretMessage " << tag("id", logevent_id()) << tag("qts", qts)
<< tag("chat_id", chat_id) << tag("date", date) << tag("auth_key_id", format::as_hex(auth_key_id))
<< tag("message_id", message_id) << tag("my_in_seq_no", my_in_seq_no)
<< tag("my_out_seq_no", my_out_seq_no) << tag("his_in_seq_no", his_in_seq_no)
<< tag("message", to_string(decrypted_message_layer)) << tag("is_pending", is_pending)
<< format::cond(has_encrypted_file, tag("file", file)) << "]";
return sb << "[Logevent InboundSecretMessage " << tag("id", logevent_id()) << tag("chat_id", chat_id)
<< tag("date", date) << tag("auth_key_id", format::as_hex(auth_key_id)) << tag("message_id", message_id)
<< tag("my_in_seq_no", my_in_seq_no) << tag("my_out_seq_no", my_out_seq_no)
<< tag("his_in_seq_no", his_in_seq_no) << tag("message", to_string(decrypted_message_layer))
<< tag("is_pending", is_pending) << format::cond(has_encrypted_file, tag("file", file)) << "]";
}
};

View File

@ -588,7 +588,6 @@ class Master : public Actor {
void add_inbound_message(int32 chat_id, BufferSlice data, uint64 crc) {
CHECK(crc64(data.as_slice()) == crc);
auto event = make_unique<logevent::InboundSecretMessage>();
event->qts = 0;
event->chat_id = chat_id;
event->date = 0;
event->encrypted_message = std::move(data);