diff options
| author | Emīls Piņķis <emils@mullvad.net> | 2018-04-13 13:09:54 +0100 |
|---|---|---|
| committer | Emīls Piņķis <emils@mullvad.net> | 2018-04-17 16:00:59 +0100 |
| commit | 06618e704849a42cf3dc522d9d30efac5c07d869 (patch) | |
| tree | 5ee6bb5e2bf9e7d03ff05f02efd266968e7e1460 /app | |
| parent | 78ef1369e72a2a46f797231345801e6a7b2af898 (diff) | |
| download | mullvadvpn-06618e704849a42cf3dc522d9d30efac5c07d869.tar.xz mullvadvpn-06618e704849a42cf3dc522d9d30efac5c07d869.zip | |
Disconnect from tunnel when UI is closed on Linux
Diffstat (limited to 'app')
| -rw-r--r-- | app/app.js | 8 | ||||
| -rw-r--r-- | app/main.js | 7 |
2 files changed, 14 insertions, 1 deletions
diff --git a/app/app.js b/app/app.js index 6e9272e88b..13a5c75f59 100644 --- a/app/app.js +++ b/app/app.js @@ -47,6 +47,14 @@ ipcRenderer.on('shutdown', () => { log.warn('Unable to shut down the backend', e.message); }); }); + +ipcRenderer.on('disconnect', () => { + log.info('Been told by the node process to disconnect the tunnel'); + backend.disconnect() + .catch( e => { + log.warn('Unable to disconnect the tunnel', e.message); + }); +}); ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// diff --git a/app/main.js b/app/main.js index 7ca5bcf2ac..0c5eb7ec73 100644 --- a/app/main.js +++ b/app/main.js @@ -95,9 +95,14 @@ const appDelegate = { ipcMain.on('hide-window', () => window.hide()); window.loadURL('file://' + path.join(__dirname, 'index.html')); - if (process.platform !== 'linux') { + if (process.platform === 'linux') { window.on('close', () => { log.debug('The browser window is closing, shutting down the tunnel...'); + window.webContents.send('disconnect'); + }); + } else { + window.on('close', () => { + log.debug('The browser window is closing, shutting down the daemon...'); window.webContents.send('shutdown'); }); } |
