summaryrefslogtreecommitdiffhomepage
path: root/app/app.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/app.js')
-rw-r--r--app/app.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/app/app.js b/app/app.js
index 13a5c75f59..429c7e39cd 100644
--- a/app/app.js
+++ b/app/app.js
@@ -55,6 +55,19 @@ ipcRenderer.on('disconnect', () => {
log.warn('Unable to disconnect the tunnel', e.message);
});
});
+
+ipcRenderer.on('app-shutdown', () => {
+ log.info('Been told by the renderer process that the app is shutting down');
+ // The shutdown behaviour may have to be different on mobile platforms
+ const shutdown_func = process.platform === 'darwin' ? () => backend.shutdown() : () => backend.disconnect();
+ shutdown_func().catch( e => {
+ log.error('Failed to shutdown tunnel: ', e);
+ });
+
+ // no matter what, don't block the frontend from shutting down, I guess.
+ ipcRenderer.send('daemon-shutdown', true);
+});
+
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////