Keep logs concerning decryption errors longer.

fork-5.53.8
Greyson Parrelli 2022-07-29 13:25:44 -04:00
rodzic ef950bdbb5
commit 4eb2f16ef1
2 zmienionych plików z 12 dodań i 12 usunięć

Wyświetl plik

@ -93,21 +93,21 @@ public class AutomaticSessionResetJob extends BaseJob {
DeviceLastResetTime resetTimes = SignalDatabase.recipients().getLastSessionResetTimes(recipientId); DeviceLastResetTime resetTimes = SignalDatabase.recipients().getLastSessionResetTimes(recipientId);
long timeSinceLastReset = System.currentTimeMillis() - getLastResetTime(resetTimes, deviceId); long timeSinceLastReset = System.currentTimeMillis() - getLastResetTime(resetTimes, deviceId);
Log.i(TAG, "DeviceId: " + deviceId + ", Reset interval: " + resetInterval + ", Time since last reset: " + timeSinceLastReset); Log.i(TAG, "DeviceId: " + deviceId + ", Reset interval: " + resetInterval + ", Time since last reset: " + timeSinceLastReset, true);
if (timeSinceLastReset > resetInterval) { if (timeSinceLastReset > resetInterval) {
Log.i(TAG, "We're good! Sending a null message."); Log.i(TAG, "We're good! Sending a null message.", true);
SignalDatabase.recipients().setLastSessionResetTime(recipientId, setLastResetTime(resetTimes, deviceId, System.currentTimeMillis())); SignalDatabase.recipients().setLastSessionResetTime(recipientId, setLastResetTime(resetTimes, deviceId, System.currentTimeMillis()));
Log.i(TAG, "Marked last reset time: " + System.currentTimeMillis()); Log.i(TAG, "Marked last reset time: " + System.currentTimeMillis(), true);
sendNullMessage(); sendNullMessage();
Log.i(TAG, "Successfully sent!"); Log.i(TAG, "Successfully sent!", true);
} else { } else {
Log.w(TAG, "Too soon! Time since last reset: " + timeSinceLastReset); Log.w(TAG, "Too soon! Time since last reset: " + timeSinceLastReset, true);
} }
} else { } else {
Log.w(TAG, "Automatic session reset send disabled!"); Log.w(TAG, "Automatic session reset send disabled!", true);
} }
} }

Wyświetl plik

@ -112,7 +112,7 @@ public final class MessageDecryptionUtil {
return DecryptionResult.forError(MessageState.INVALID_VERSION, toExceptionMetadata(e), jobs); return DecryptionResult.forError(MessageState.INVALID_VERSION, toExceptionMetadata(e), jobs);
} catch (ProtocolInvalidKeyIdException | ProtocolInvalidKeyException | ProtocolUntrustedIdentityException | ProtocolNoSessionException | ProtocolInvalidMessageException e) { } catch (ProtocolInvalidKeyIdException | ProtocolInvalidKeyException | ProtocolUntrustedIdentityException | ProtocolNoSessionException | ProtocolInvalidMessageException e) {
Log.w(TAG, String.valueOf(envelope.getTimestamp()), e); Log.w(TAG, String.valueOf(envelope.getTimestamp()), e, true);
Recipient sender = Recipient.external(context, e.getSender()); Recipient sender = Recipient.external(context, e.getSender());
if (sender.supportsMessageRetries() && Recipient.self().supportsMessageRetries() && FeatureFlags.retryReceipts()) { if (sender.supportsMessageRetries() && Recipient.self().supportsMessageRetries() && FeatureFlags.retryReceipts()) {
@ -155,11 +155,11 @@ public final class MessageDecryptionUtil {
try { try {
groupId = Optional.of(GroupId.push(protocolException.getGroupId().get())); groupId = Optional.of(GroupId.push(protocolException.getGroupId().get()));
} catch (BadGroupIdException e) { } catch (BadGroupIdException e) {
Log.w(TAG, "[" + envelope.getTimestamp() + "] Bad groupId!"); Log.w(TAG, "[" + envelope.getTimestamp() + "] Bad groupId!", true);
} }
} }
Log.w(TAG, "[" + envelope.getTimestamp() + "] Could not decrypt a message with a type of " + contentHint); Log.w(TAG, "[" + envelope.getTimestamp() + "] Could not decrypt a message with a type of " + contentHint, true);
long threadId; long threadId;
@ -172,16 +172,16 @@ public final class MessageDecryptionUtil {
switch (contentHint) { switch (contentHint) {
case DEFAULT: case DEFAULT:
Log.w(TAG, "[" + envelope.getTimestamp() + "] Inserting an error right away because it's " + contentHint); Log.w(TAG, "[" + envelope.getTimestamp() + "] Inserting an error right away because it's " + contentHint, true);
SignalDatabase.sms().insertBadDecryptMessage(sender.getId(), senderDevice, envelope.getTimestamp(), receivedTimestamp, threadId); SignalDatabase.sms().insertBadDecryptMessage(sender.getId(), senderDevice, envelope.getTimestamp(), receivedTimestamp, threadId);
break; break;
case RESENDABLE: case RESENDABLE:
Log.w(TAG, "[" + envelope.getTimestamp() + "] Inserting into pending retries store because it's " + contentHint); Log.w(TAG, "[" + envelope.getTimestamp() + "] Inserting into pending retries store because it's " + contentHint, true);
ApplicationDependencies.getPendingRetryReceiptCache().insert(sender.getId(), senderDevice, envelope.getTimestamp(), receivedTimestamp, threadId); ApplicationDependencies.getPendingRetryReceiptCache().insert(sender.getId(), senderDevice, envelope.getTimestamp(), receivedTimestamp, threadId);
ApplicationDependencies.getPendingRetryReceiptManager().scheduleIfNecessary(); ApplicationDependencies.getPendingRetryReceiptManager().scheduleIfNecessary();
break; break;
case IMPLICIT: case IMPLICIT:
Log.w(TAG, "[" + envelope.getTimestamp() + "] Not inserting any error because it's " + contentHint); Log.w(TAG, "[" + envelope.getTimestamp() + "] Not inserting any error because it's " + contentHint, true);
break; break;
} }