Don't retry messages if they fail for another reason than untrusted identity

This commit is contained in:
AsamK 2020-11-21 11:51:31 +01:00
parent 019efbe22c
commit 2ab8646168

View file

@ -1398,7 +1398,15 @@ public class Manager implements Closeable {
if (!envelope.isReceipt()) { if (!envelope.isReceipt()) {
try { try {
content = decryptMessage(envelope); content = decryptMessage(envelope);
} catch (Exception e) { } catch (org.whispersystems.libsignal.UntrustedIdentityException e) {
return;
} catch (Exception er) {
// All other errors are not recoverable, so delete the cached message
try {
Files.delete(fileEntry.toPath());
} catch (IOException e) {
System.err.println("Failed to delete cached message file “" + fileEntry + "”: " + e.getMessage());
}
return; return;
} }
List<HandleAction> actions = handleMessage(envelope, content, ignoreAttachments); List<HandleAction> actions = handleMessage(envelope, content, ignoreAttachments);
@ -1476,6 +1484,7 @@ public class Manager implements Closeable {
System.err.println("Ignoring error: " + e.getMessage()); System.err.println("Ignoring error: " + e.getMessage());
continue; continue;
} }
if (envelope.hasSource()) { if (envelope.hasSource()) {
// Store uuid if we don't have it already // Store uuid if we don't have it already
SignalServiceAddress source = envelope.getSourceAddress(); SignalServiceAddress source = envelope.getSourceAddress();