summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAndrej Mihajlov <and@mullvad.net>2018-11-19 16:20:24 +0100
committerAndrej Mihajlov <and@mullvad.net>2018-11-20 10:49:40 +0100
commit2e62c4f2a7593fe03c9dade30d9d92d810c6211c (patch)
tree39052bd0269c50ea237675e715e5f0b9c68f0b98
parenteae5f1e410c6cd5e6f3ca533ac9fe14f69f9da56 (diff)
downloadmullvadvpn-2e62c4f2a7593fe03c9dade30d9d92d810c6211c.tar.xz
mullvadvpn-2e62c4f2a7593fe03c9dade30d9d92d810c6211c.zip
Prevent fetching the location during reconnection loop
-rw-r--r--gui/packages/desktop/src/main/index.js14
1 files changed, 11 insertions, 3 deletions
diff --git a/gui/packages/desktop/src/main/index.js b/gui/packages/desktop/src/main/index.js
index e7f56fce97..4e432f2c31 100644
--- a/gui/packages/desktop/src/main/index.js
+++ b/gui/packages/desktop/src/main/index.js
@@ -438,9 +438,11 @@ const ApplicationMain = {
},
_setTunnelState(newState: TunnelStateTransition) {
+ const oldState = this._tunnelState;
+
this._tunnelState = newState;
this._updateTrayIcon(newState.state);
- this._updateLocation(newState.state);
+ this._updateLocation(oldState, newState);
if (!this._shouldSuppressNotifications()) {
this._notificationController.notifyTunnelState(newState);
@@ -601,8 +603,14 @@ const ApplicationMain = {
return this._windowController && this._windowController.isVisible();
},
- async _updateLocation(tunnelState: TunnelState) {
- if (['connected', 'connecting', 'disconnected'].includes(tunnelState)) {
+ async _updateLocation(oldState: TunnelStateTransition, newState: TunnelStateTransition) {
+ if (
+ newState.state === 'connected' ||
+ newState.state === 'disconnected' ||
+ // Guard from fetching the location during reconnection loop.
+ (newState.state === 'connecting' &&
+ !(oldState.state === 'disconnecting' && oldState.details === 'reconnect'))
+ ) {
try {
this._setLocation(await this._daemonRpc.getLocation());
} catch (error) {