diff options
| author | Emīls Piņķis <emils@mullvad.net> | 2018-05-03 11:01:41 +0100 |
|---|---|---|
| committer | Emīls Piņķis <emils@mullvad.net> | 2018-05-03 11:01:41 +0100 |
| commit | 217ea838b3b85574af36856475d5951fb0b14a30 (patch) | |
| tree | 8f98e8e05aad5a8752636d41356c543ba0c518da /app/app.js | |
| parent | 1b514f646bbb1bb73ae8e4db3365d9c1cc5b4b9e (diff) | |
| parent | 0b30e5e5f4d118a05507f0303870f83d1ecda7a7 (diff) | |
| download | mullvadvpn-217ea838b3b85574af36856475d5951fb0b14a30.tar.xz mullvadvpn-217ea838b3b85574af36856475d5951fb0b14a30.zip | |
Merge branch 'bugfix-disconnect-tunnel-on-app-shutdown'
Diffstat (limited to 'app/app.js')
| -rw-r--r-- | app/app.js | 13 |
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); +}); + ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// |
