Don't save a MessageCounterError

Fixes #446

// FREEBIE
This commit is contained in:
lilia 2015-12-03 18:37:45 -08:00
parent 8d243738f3
commit edcb28aebb
3 changed files with 11 additions and 2 deletions

View file

@ -200,6 +200,11 @@
}
if (ev.proto) {
if (e.name === 'MessageCounterError') {
// Ignore this message. It is likely a duplicate delivery
// because the server lost our ack the first time.
return;
}
var envelope = ev.proto;
var message = initIncomingMessage(envelope.source, envelope.timestamp.toNumber());
message.saveErrors(e).then(function() {

View file

@ -34806,7 +34806,9 @@ window.axolotl.protocol = function(storage_interface) {
return fillMessageKeys(chain, message.counter).then(function() {
var messageKey = chain.messageKeys[message.counter];
if (messageKey === undefined) {
throw new Error("Message key not found. The counter was repeated or the key was not filled.");
var e = new Error("Message key not found. The counter was repeated or the key was not filled.");
e.name = 'MessageCounterError';
throw e;
}
return HKDF(axolotlInternal.utils.convertToArrayBuffer(messageKey), '', "WhisperMessageKeys").then(function(keys) {
return storage_interface.getMyIdentityKey().then(function(ourIdentityKey) {

View file

@ -34708,7 +34708,9 @@ window.axolotl.protocol = function(storage_interface) {
return fillMessageKeys(chain, message.counter).then(function() {
var messageKey = chain.messageKeys[message.counter];
if (messageKey === undefined) {
throw new Error("Message key not found. The counter was repeated or the key was not filled.");
var e = new Error("Message key not found. The counter was repeated or the key was not filled.");
e.name = 'MessageCounterError';
throw e;
}
return HKDF(axolotlInternal.utils.convertToArrayBuffer(messageKey), '', "WhisperMessageKeys").then(function(keys) {
return storage_interface.getMyIdentityKey().then(function(ourIdentityKey) {