mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-25 06:54:43 +00:00
Improve mtproto connections logging.
This commit is contained in:
@@ -39,7 +39,6 @@ constexpr auto kPingSendAfter = 30 * crl::time(1000);
|
||||
constexpr auto kPingSendAfterForce = 45 * crl::time(1000);
|
||||
constexpr auto kTemporaryExpiresIn = TimeId(86400);
|
||||
constexpr auto kBindKeyAdditionalExpiresTimeout = TimeId(30);
|
||||
constexpr auto kTestModeDcIdShift = 10000;
|
||||
constexpr auto kKeyOldEnoughForDestroy = 60 * crl::time(1000);
|
||||
constexpr auto kSentContainerLives = 600 * crl::time(1000);
|
||||
constexpr auto kFastRequestDuration = crl::time(500);
|
||||
@@ -1252,14 +1251,10 @@ void SessionPrivate::handleReceived() {
|
||||
auto ints = intsBuffer.constData();
|
||||
if ((intsCount < kMinimalIntsCount) || (intsCount > kMaxMessageLength / kIntSize)) {
|
||||
LOG(("TCP Error: bad message received, len %1").arg(intsCount * kIntSize));
|
||||
TCP_LOG(("TCP Error: bad message %1").arg(Logs::mb(ints, intsCount * kIntSize).str()));
|
||||
|
||||
return restart();
|
||||
}
|
||||
if (_keyId != *(uint64*)ints) {
|
||||
LOG(("TCP Error: bad auth_key_id %1 instead of %2 received").arg(_keyId).arg(*(uint64*)ints));
|
||||
TCP_LOG(("TCP Error: bad message %1").arg(Logs::mb(ints, intsCount * kIntSize).str()));
|
||||
|
||||
return restart();
|
||||
}
|
||||
|
||||
@@ -1297,8 +1292,6 @@ void SessionPrivate::handleReceived() {
|
||||
constexpr auto kMsgKeyShift = 8U;
|
||||
if (ConstTimeIsDifferent(&msgKey, sha256Buffer.data() + kMsgKeyShift, sizeof(msgKey))) {
|
||||
LOG(("TCP Error: bad SHA256 hash after aesDecrypt in message"));
|
||||
TCP_LOG(("TCP Error: bad message %1").arg(Logs::mb(encryptedInts, encryptedBytesCount).str()));
|
||||
|
||||
return restart();
|
||||
}
|
||||
|
||||
@@ -1307,17 +1300,19 @@ void SessionPrivate::handleReceived() {
|
||||
|| (paddingSize < kMinPaddingSize)
|
||||
|| (paddingSize > kMaxPaddingSize)) {
|
||||
LOG(("TCP Error: bad msg_len received %1, data size: %2").arg(messageLength).arg(encryptedBytesCount));
|
||||
TCP_LOG(("TCP Error: bad message %1").arg(Logs::mb(encryptedInts, encryptedBytesCount).str()));
|
||||
|
||||
return restart();
|
||||
}
|
||||
|
||||
TCP_LOG(("TCP Info: decrypted message %1,%2,%3 is %4 len").arg(msgId).arg(seqNo).arg(Logs::b(needAck)).arg(fullDataLength));
|
||||
if (Logs::DebugEnabled()) {
|
||||
_connection->logInfo(u"Decrypted message %1,%2,%3 is %4 len"_q
|
||||
.arg(msgId)
|
||||
.arg(seqNo)
|
||||
.arg(Logs::b(needAck))
|
||||
.arg(fullDataLength));
|
||||
}
|
||||
|
||||
if (session != _sessionId) {
|
||||
LOG(("MTP Error: bad server session received"));
|
||||
TCP_LOG(("MTP Error: bad server session %1 instead of %2 in message received").arg(session).arg(_sessionId));
|
||||
|
||||
return restart();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user