Skip to content
This repository has been archived by the owner on Aug 5, 2021. It is now read-only.

Commit

Permalink
fillMessageKeys: only check for >1000 if message not from yourself
Browse files Browse the repository at this point in the history
People leave their laptops closed for weeks at a time, and get this
error, since their other devices are sending messages to it constantly:

"Too many message keys for chain"

And it seems to be really hard to fix once you're in this state. Sync
messages no longer show up from the device that got into this state.

FREEBIE
  • Loading branch information
scottnonnenberg committed Jul 26, 2017
1 parent 8c5c6b6 commit 0fdb998
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion dist/libsignal-protocol.js
Original file line number Diff line number Diff line change
Expand Up @@ -36274,7 +36274,10 @@ SessionCipher.prototype = {
});
},
fillMessageKeys: function(chain, counter) {
if (Object.keys(chain.messageKeys).length >= 1000) {
var ourNumber = textsecure.storage.user.getNumber();
var theirNumber = this.remoteAddress.toString().split('.')[0];

if (ourNumber !== theirNumber && Object.keys(chain.messageKeys).length >= 1000) {
console.log("Too many message keys for chain");
return Promise.resolve(); // Stalker, much?
}
Expand Down
5 changes: 4 additions & 1 deletion src/SessionCipher.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,10 @@ SessionCipher.prototype = {
});
},
fillMessageKeys: function(chain, counter) {
if (Object.keys(chain.messageKeys).length >= 1000) {
var ourNumber = textsecure.storage.user.getNumber();
var theirNumber = this.remoteAddress.toString().split('.')[0];

if (ourNumber !== theirNumber && Object.keys(chain.messageKeys).length >= 1000) {
console.log("Too many message keys for chain");
return Promise.resolve(); // Stalker, much?
}
Expand Down

0 comments on commit 0fdb998

Please sign in to comment.