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,
|
number,
|
||||||
deviceIds
|
deviceIds
|
||||||
);
|
);
|
||||||
throw error;
|
|
||||||
} else {
|
const address = new libsignal.SignalProtocolAddress(number, 1);
|
||||||
this.registerError(number, 'Failed to create or send message', error);
|
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;
|
return null;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Reference in a new issue