diff options
| author | Emīls Piņķis <emils@mullvad.net> | 2018-04-19 12:45:00 +0100 |
|---|---|---|
| committer | Emīls Piņķis <emils@mullvad.net> | 2018-04-19 12:45:00 +0100 |
| commit | e6c2c7eb9a81c6917a806cb77085620bdfe491a3 (patch) | |
| tree | 9ae2cb2c3642e9aee6e5a5afd7a6efcc8f5b8996 | |
| parent | 86ce745b422026d46f970f17279a3489c34e2f40 (diff) | |
| parent | c466d5a16cb84f9365e33dc3bf528712f1762ad3 (diff) | |
| download | mullvadvpn-e6c2c7eb9a81c6917a806cb77085620bdfe491a3.tar.xz mullvadvpn-e6c2c7eb9a81c6917a806cb77085620bdfe491a3.zip | |
Merge branch 'display-correct-state-if-connected'
| -rw-r--r-- | app/lib/backend.js | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/app/lib/backend.js b/app/lib/backend.js index 88e4277be6..6f54b1b26e 100644 --- a/app/lib/backend.js +++ b/app/lib/backend.js @@ -265,6 +265,13 @@ export class Backend { async connect() { try { + let currentState = await this._ipc.getState(); + if (currentState.state === 'secured') { + log.debug('Refusing to connect as connection is already secured'); + this._store.dispatch(connectionActions.connected()); + return; + } + this._store.dispatch(connectionActions.connecting()); await this._ensureAuthenticated(); @@ -476,10 +483,10 @@ export class Backend { async _registerIpcListeners() { await this._ensureAuthenticated(); this._ipc.registerStateListener(newState => { - log.debug('Got new state from backend', newState); - const newStatus = this._securityStateToConnectionState(newState); - this._dispatchConnectionState(newStatus); + const connectionState = this._securityStateToConnectionState(newState); + log.debug('Got new state from backend ${newState}, translated to ${connectionState}'); + this._dispatchConnectionState(connectionState); this.sync(); }); } |
