Minor logging impprovements.

GitOrigin-RevId: 54f2abbd0be6d3ee5cd88ac75f14a660c0201359
This commit is contained in:
levlam 2019-05-13 19:34:23 +03:00
parent b4b9778947
commit 4f9887b4bd
4 changed files with 16 additions and 15 deletions

View File

@ -433,7 +433,7 @@ Status SessionConnection::on_packet(const MsgInfo &info, const mtproto_api::futu
Status SessionConnection::on_msgs_state_info(const std::vector<int64> &ids, Slice info) {
if (ids.size() != info.size()) {
return Status::Error(PSLICE() << tag("ids.size()", ids.size()) << "!=" << tag("info.size()", info.size()));
return Status::Error(PSLICE() << tag("ids.size()", ids.size()) << " != " << tag("info.size()", info.size()));
}
size_t i = 0;
for (auto id : ids) {

View File

@ -180,7 +180,7 @@ size_t Transport::calc_no_crypto_size(size_t data_size) {
Status Transport::read_no_crypto(MutableSlice message, PacketInfo *info, MutableSlice *data) {
if (message.size() < sizeof(NoCryptoHeader)) {
return Status::Error(PSLICE() << "Invalid mtproto message: too small [message.size()=" << message.size()
return Status::Error(PSLICE() << "Invalid mtproto message: too small [message.size() = " << message.size()
<< "] < [sizeof(NoCryptoHeader) = " << sizeof(NoCryptoHeader) << "]");
}
size_t data_size = message.size() - sizeof(NoCryptoHeader);
@ -193,7 +193,7 @@ template <class HeaderT, class PrefixT>
Status Transport::read_crypto_impl(int X, MutableSlice message, const AuthKey &auth_key, HeaderT **header_ptr,
PrefixT **prefix_ptr, MutableSlice *data, PacketInfo *info) {
if (message.size() < sizeof(HeaderT)) {
return Status::Error(PSLICE() << "Invalid mtproto message: too small [message.size()=" << message.size()
return Status::Error(PSLICE() << "Invalid mtproto message: too small [message.size() = " << message.size()
<< "] < [sizeof(HeaderT) = " << sizeof(HeaderT) << "]");
}
//FIXME: rewrite without reinterpret cast
@ -202,14 +202,14 @@ Status Transport::read_crypto_impl(int X, MutableSlice message, const AuthKey &a
auto to_decrypt = MutableSlice(header->encrypt_begin(), message.uend());
to_decrypt = to_decrypt.truncate(to_decrypt.size() & ~15);
if (to_decrypt.size() % 16 != 0) {
return Status::Error(PSLICE() << "Invalid mtproto message: size of encrypted part is not multiple of 16 [size="
return Status::Error(PSLICE() << "Invalid mtproto message: size of encrypted part is not multiple of 16 [size = "
<< to_decrypt.size() << "]");
}
if (header->auth_key_id != auth_key.id()) {
return Status::Error(PSLICE() << "Invalid mtproto message: auth_key_id mismatch [found="
return Status::Error(PSLICE() << "Invalid mtproto message: auth_key_id mismatch [found = "
<< format::as_hex(header->auth_key_id)
<< "] [expected=" << format::as_hex(auth_key.id()) << "]");
<< "] [expected = " << format::as_hex(auth_key.id()) << "]");
}
UInt256 aes_key;
@ -249,9 +249,9 @@ Status Transport::read_crypto_impl(int X, MutableSlice message, const AuthKey &a
}
if (!is_key_ok) {
return Status::Error(PSLICE() << "Invalid mtproto message: message_key mismatch [found="
return Status::Error(PSLICE() << "Invalid mtproto message: message_key mismatch [found = "
<< format::as_hex_dump(header->message_key)
<< "] [expected=" << format::as_hex_dump(real_message_key) << "]");
<< "] [expected = " << format::as_hex_dump(real_message_key) << "]");
}
if (info->version == 2) {
@ -405,7 +405,7 @@ size_t Transport::write_e2e_crypto(const Storer &storer, const AuthKey &auth_key
Result<uint64> Transport::read_auth_key_id(Slice message) {
if (message.size() < 8) {
return Status::Error(PSLICE() << "Invalid mtproto message: smaller than 8 bytes [size=" << message.size() << "]");
return Status::Error(PSLICE() << "Invalid mtproto message: smaller than 8 bytes [size = " << message.size() << "]");
}
return as<uint64>(message.begin());
}
@ -413,7 +413,8 @@ Result<uint64> Transport::read_auth_key_id(Slice message) {
Result<Transport::ReadResult> Transport::read(MutableSlice message, const AuthKey &auth_key, PacketInfo *info) {
if (message.size() < 12) {
if (message.size() < 4) {
return Status::Error(PSLICE() << "Invalid mtproto message: smaller than 4 bytes [size=" << message.size() << "]");
return Status::Error(PSLICE() << "Invalid mtproto message: smaller than 4 bytes [size = " << message.size()
<< "]");
}
int32 code = as<int32>(message.begin());

View File

@ -496,8 +496,8 @@ void SecretChatActor::send_action(tl_object_ptr<secret_api::DecryptedMessageActi
void SecretChatActor::binlog_replay_finish() {
on_his_in_seq_no_updated();
LOG(INFO) << "Binlog replay is finished with SeqNoState=" << seq_no_state_;
LOG(INFO) << "Binlog replay is finished with PfsState=" << pfs_state_;
LOG(INFO) << "Binlog replay is finished with SeqNoState " << seq_no_state_;
LOG(INFO) << "Binlog replay is finished with PfsState " << pfs_state_;
binlog_replay_finish_flag_ = true;
if (auth_state_.state == State::Ready) {
if (config_state_.my_layer < MY_LAYER) {
@ -1947,8 +1947,8 @@ void SecretChatActor::start_up() {
// auto end = Time::now();
// CHECK(end - start < 0.2);
LOG(INFO) << "In start_up with SeqNoState=" << seq_no_state_;
LOG(INFO) << "In start_up with PfsState=" << pfs_state_;
LOG(INFO) << "In start_up with SeqNoState " << seq_no_state_;
LOG(INFO) << "In start_up with PfsState " << pfs_state_;
}
void SecretChatActor::get_dh_config() {

View File

@ -864,7 +864,7 @@ void Session::connection_send_query(ConnectionInfo *info, NetQueryPtr &&net_quer
message_id, Query{message_id, std::move(net_query), main_connection_.connection_id, Time::now_cached()});
sent_queries_list_.put(status.first->second.get_list_node());
if (!status.second) {
LOG(FATAL) << "Duplicate message_id oO [message_id=" << message_id << "]";
LOG(FATAL) << "Duplicate message_id [message_id = " << message_id << "]";
}
}