diff options
| author | Oskar Nyberg <oskar@mullvad.net> | 2021-09-21 15:34:35 +0200 |
|---|---|---|
| committer | Oskar Nyberg <oskar@mullvad.net> | 2021-09-21 15:34:35 +0200 |
| commit | 6fdcebbe769894c821d14369eb65e41c19d52907 (patch) | |
| tree | 1d93c067e410cf84002a3952628fe119e1089e9e /gui/src | |
| parent | ed7c7612b75d774ffa343052ac93c24709f903f2 (diff) | |
| parent | ab348bb1f77da0b3ad66ba9789f918436b10b0a0 (diff) | |
| download | mullvadvpn-6fdcebbe769894c821d14369eb65e41c19d52907.tar.xz mullvadvpn-6fdcebbe769894c821d14369eb65e41c19d52907.zip | |
Merge branch 'update-grpc-js'
Diffstat (limited to 'gui/src')
| -rw-r--r-- | gui/src/main/daemon-rpc.ts | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/gui/src/main/daemon-rpc.ts b/gui/src/main/daemon-rpc.ts index 0619e873ca..89360fbc15 100644 --- a/gui/src/main/daemon-rpc.ts +++ b/gui/src/main/daemon-rpc.ts @@ -155,7 +155,11 @@ export class DaemonRpc { public disconnect() { this.isConnected = false; - this.subscriptions.clear(); + + for (const subscriptionId of this.subscriptions.keys()) { + this.removeSubscription(subscriptionId); + } + this.client.close(); if (this.reconnectionTimeout) { clearTimeout(this.reconnectionTimeout); @@ -558,14 +562,14 @@ export class DaemonRpc { this.subscriptions.delete(id); subscription.removeAllListeners('data'); subscription.removeAllListeners('error'); - try { - subscription.cancel(); - } catch (e) { + + subscription.on('error', (e) => { const error = e as grpc.ServiceError; if (error.code !== grpc.status.CANCELLED) { throw error; } - } + }); + subscription.cancel(); } } |
