OutgoingMessage: On OutgoingKeyError, archive all sessions
* OutgoingMessage: On OutgoingKeyError, archive all sessions * Improve logging
This commit is contained in:
parent
1bf9ca7233
commit
14cc11d5de
1 changed files with 27 additions and 3 deletions
|
@ -413,11 +413,35 @@ OutgoingMessage.prototype = {
|
|||
number,
|
||||
deviceIds
|
||||
);
|
||||
throw error;
|
||||
} else {
|
||||
this.registerError(number, 'Failed to create or send message', error);
|
||||
|
||||
const address = new libsignal.SignalProtocolAddress(number, 1);
|
||||
const identifier = address.toString();
|
||||
window.log.info('closing all sessions for', number);
|
||||
|
||||
const sessionCipher = new libsignal.SessionCipher(
|
||||
textsecure.storage.protocol,
|
||||
address
|
||||
);
|
||||
window.log.info('closing session for', address.toString());
|
||||
return Promise.all([
|
||||
// Primary device
|
||||
sessionCipher.closeOpenSessionForDevice(),
|
||||
// The rest of their devices
|
||||
textsecure.storage.protocol.archiveSiblingSessions(identifier),
|
||||
]).then(
|
||||
() => {
|
||||
throw error;
|
||||
},
|
||||
innerError => {
|
||||
window.log.error(
|
||||
`doSendMessage: Error closing sessions: ${innerError.stack}`
|
||||
);
|
||||
throw error;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
this.registerError(number, 'Failed to create or send message', error);
|
||||
return null;
|
||||
});
|
||||
},
|
||||
|
|
Loading…
Add table
Reference in a new issue