Remove unknown group messages from cache - no need to retry! (#1414)

FREEBIE
This commit is contained in:
Scott Nonnenberg 2017-08-30 14:40:08 -07:00 committed by GitHub
parent 52a595b372
commit 36e8b82b5f
2 changed files with 8 additions and 6 deletions

View file

@ -38674,7 +38674,7 @@ MessageReceiver.prototype.extend({
p = this.handleEndSession(destination); p = this.handleEndSession(destination);
} }
return p.then(function() { return p.then(function() {
return this.processDecrypted(message, this.number).then(function(message) { return this.processDecrypted(envelope, message, this.number).then(function(message) {
var ev = new Event('sent'); var ev = new Event('sent');
ev.confirm = this.removeFromCache.bind(this, envelope); ev.confirm = this.removeFromCache.bind(this, envelope);
ev.data = { ev.data = {
@ -38698,7 +38698,7 @@ MessageReceiver.prototype.extend({
p = this.handleEndSession(envelope.source); p = this.handleEndSession(envelope.source);
} }
return p.then(function() { return p.then(function() {
return this.processDecrypted(message, envelope.source).then(function(message) { return this.processDecrypted(envelope, message, envelope.source).then(function(message) {
var ev = new Event('message'); var ev = new Event('message');
ev.confirm = this.removeFromCache.bind(this, envelope); ev.confirm = this.removeFromCache.bind(this, envelope);
ev.data = { ev.data = {
@ -39008,7 +39008,7 @@ MessageReceiver.prototype.extend({
})); }));
}); });
}, },
processDecrypted: function(decrypted, source) { processDecrypted: function(envelope, decrypted, source) {
// Now that its decrypted, validate the message and clean it up for consumer processing // Now that its decrypted, validate the message and clean it up for consumer processing
// Note that messages may (generally) only perform one action and we ignore remaining fields // Note that messages may (generally) only perform one action and we ignore remaining fields
// after the first action. // after the first action.
@ -39082,6 +39082,7 @@ MessageReceiver.prototype.extend({
break; break;
default: default:
this.removeFromCache(envelope);
throw new Error("Unknown group message type"); throw new Error("Unknown group message type");
} }
} }

View file

@ -423,7 +423,7 @@ MessageReceiver.prototype.extend({
p = this.handleEndSession(destination); p = this.handleEndSession(destination);
} }
return p.then(function() { return p.then(function() {
return this.processDecrypted(message, this.number).then(function(message) { return this.processDecrypted(envelope, message, this.number).then(function(message) {
var ev = new Event('sent'); var ev = new Event('sent');
ev.confirm = this.removeFromCache.bind(this, envelope); ev.confirm = this.removeFromCache.bind(this, envelope);
ev.data = { ev.data = {
@ -447,7 +447,7 @@ MessageReceiver.prototype.extend({
p = this.handleEndSession(envelope.source); p = this.handleEndSession(envelope.source);
} }
return p.then(function() { return p.then(function() {
return this.processDecrypted(message, envelope.source).then(function(message) { return this.processDecrypted(envelope, message, envelope.source).then(function(message) {
var ev = new Event('message'); var ev = new Event('message');
ev.confirm = this.removeFromCache.bind(this, envelope); ev.confirm = this.removeFromCache.bind(this, envelope);
ev.data = { ev.data = {
@ -757,7 +757,7 @@ MessageReceiver.prototype.extend({
})); }));
}); });
}, },
processDecrypted: function(decrypted, source) { processDecrypted: function(envelope, decrypted, source) {
// Now that its decrypted, validate the message and clean it up for consumer processing // Now that its decrypted, validate the message and clean it up for consumer processing
// Note that messages may (generally) only perform one action and we ignore remaining fields // Note that messages may (generally) only perform one action and we ignore remaining fields
// after the first action. // after the first action.
@ -831,6 +831,7 @@ MessageReceiver.prototype.extend({
break; break;
default: default:
this.removeFromCache(envelope);
throw new Error("Unknown group message type"); throw new Error("Unknown group message type");
} }
} }