Clean up shutdown handling - stop processing incoming messages
This commit is contained in:
parent
ce9a52dde3
commit
77ae717b9b
2 changed files with 31 additions and 17 deletions
|
@ -274,6 +274,19 @@
|
|||
},
|
||||
|
||||
shutdown: async () => {
|
||||
// Stop background processing
|
||||
window.Signal.AttachmentDownloads.stop();
|
||||
if (idleDetector) {
|
||||
idleDetector.stop();
|
||||
}
|
||||
|
||||
// Stop processing incoming messages
|
||||
if (messageReceiver) {
|
||||
await messageReceiver.stopProcessing();
|
||||
messageReceiver = null;
|
||||
}
|
||||
|
||||
// Shut down the data interface cleanly
|
||||
await window.Signal.Data.shutdown();
|
||||
},
|
||||
};
|
||||
|
@ -428,16 +441,6 @@
|
|||
}
|
||||
});
|
||||
|
||||
Whisper.events.on('shutdown', async () => {
|
||||
if (idleDetector) {
|
||||
idleDetector.stop();
|
||||
}
|
||||
if (messageReceiver) {
|
||||
await messageReceiver.close();
|
||||
}
|
||||
Whisper.events.trigger('shutdown-complete');
|
||||
});
|
||||
|
||||
Whisper.events.on('setupWithImport', () => {
|
||||
const { appView } = window.owsDesktopApp;
|
||||
if (appView) {
|
||||
|
@ -549,13 +552,6 @@
|
|||
window.getSyncRequest = () =>
|
||||
new textsecure.SyncRequest(textsecure.messaging, messageReceiver);
|
||||
|
||||
Whisper.events.on('start-shutdown', async () => {
|
||||
if (messageReceiver) {
|
||||
await messageReceiver.close();
|
||||
}
|
||||
Whisper.events.trigger('shutdown-complete');
|
||||
});
|
||||
|
||||
let disconnectTimer = null;
|
||||
function onOffline() {
|
||||
window.log.info('offline');
|
||||
|
@ -1327,6 +1323,11 @@
|
|||
) {
|
||||
Whisper.events.trigger('unauthorized');
|
||||
|
||||
if (messageReceiver) {
|
||||
await messageReceiver.stopProcessing();
|
||||
messageReceiver = null;
|
||||
}
|
||||
|
||||
window.log.warn(
|
||||
'Client is no longer authorized; deleting local configuration'
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue