summaryrefslogtreecommitdiffhomepage
path: root/gui/src
diff options
context:
space:
mode:
authorEmīls <emils@mullvad.net>2020-08-05 19:50:08 +0100
committerDavid Lönnhager <david.l@mullvad.net>2020-08-20 14:41:41 +0200
commit21753e328aecc88c2ee8891bcab566035c174651 (patch)
tree750a79ca387cf58cde24a2e64ae7b1d3313ba8a5 /gui/src
parent290ed08658d1923b788deeef4360906e92ccff82 (diff)
downloadmullvadvpn-21753e328aecc88c2ee8891bcab566035c174651.tar.xz
mullvadvpn-21753e328aecc88c2ee8891bcab566035c174651.zip
Connect to daemon over GRPC
Diffstat (limited to 'gui/src')
-rw-r--r--gui/src/main/index.ts17
1 files changed, 6 insertions, 11 deletions
diff --git a/gui/src/main/index.ts b/gui/src/main/index.ts
index 5c7b0827e0..58d93edcd1 100644
--- a/gui/src/main/index.ts
+++ b/gui/src/main/index.ts
@@ -63,7 +63,7 @@ import WindowController from './window-controller';
const linuxSplitTunneling = process.platform === 'linux' && require('./linux-split-tunneling');
const DAEMON_RPC_PATH =
- process.platform === 'win32' ? '//./pipe/Mullvad VPN' : '/var/run/mullvad-vpn';
+ process.platform === 'win32' ? 'unix:////./pipe/Mullvad VPN' : 'unix:///var/run/mullvad-vpn';
const AUTO_CONNECT_FALLBACK_DELAY = 6000;
@@ -95,7 +95,7 @@ class ApplicationMain {
private windowController?: WindowController;
private trayIconController?: TrayIconController;
- private daemonRpc = new DaemonRpc();
+ private daemonRpc = new DaemonRpc(DAEMON_RPC_PATH);
private daemonEventListener?: SubscriptionListener<DaemonEvent>;
private reconnectBackoff = new ReconnectionBackoff();
private connectedToDaemon = false;
@@ -506,6 +506,9 @@ class ApplicationMain {
// Reset the daemon event listener since it's going to be invalidated on disconnect
this.daemonEventListener = undefined;
+ // TODO: GRPC doesn't set an error, but without an error, the UI won't be updated
+ error = error === undefined && wasConnected ? new Error('Connection to daemon lost') : error;
+
if (wasConnected) {
this.connectedToDaemon = false;
@@ -528,21 +531,13 @@ class ApplicationMain {
} else {
log.error(`Failed to connect to daemon: ${error.message}`);
}
-
- this.reconnectToDaemon();
} else {
log.info('Disconnected from the daemon');
}
};
private connectToDaemon() {
- consumePromise(this.daemonRpc.connect({ path: DAEMON_RPC_PATH }));
- }
-
- private reconnectToDaemon() {
- this.reconnectBackoff.attempt(() => {
- this.connectToDaemon();
- });
+ consumePromise(this.daemonRpc.connect());
}
private recoverFromBootstrapError(_error?: Error) {