summaryrefslogtreecommitdiffhomepage
path: root/app/lib
diff options
context:
space:
mode:
authorAndrej Mihajlov <and@mullvad.net>2017-12-04 15:12:15 +0100
committerAndrej Mihajlov <and@mullvad.net>2017-12-06 13:36:25 +0100
commit7a915b67b14fb436431fdcad4e515264fbef7505 (patch)
tree4638a68559d93514b4ee7cbf0e9d580ba2a55ae6 /app/lib
parent75057e7c4017312546281e50f8fb748ce643ec2f (diff)
downloadmullvadvpn-7a915b67b14fb436431fdcad4e515264fbef7505.tar.xz
mullvadvpn-7a915b67b14fb436431fdcad4e515264fbef7505.zip
Convert Backend._registerIpcListeners() to async
Diffstat (limited to 'app/lib')
-rw-r--r--app/lib/backend.js39
1 files changed, 18 insertions, 21 deletions
diff --git a/app/lib/backend.js b/app/lib/backend.js
index a9526b73f7..c4492fc77b 100644
--- a/app/lib/backend.js
+++ b/app/lib/backend.js
@@ -400,28 +400,25 @@ export class Backend {
}, 0);
}
- _registerIpcListeners() {
- return this._ensureAuthenticated()
- .then( () => {
- return this._ipc.registerStateListener(newState => {
- log.debug('Got new state from backend', newState);
-
- const newStatus = this._securityStateToConnectionState(newState);
- switch(newStatus) {
- case 'connecting':
- this._store.dispatch(connectionActions.connecting());
- break;
- case 'connected':
- this._store.dispatch(connectionActions.connected());
- break;
- case 'disconnected':
- this._store.dispatch(connectionActions.disconnected());
- break;
- }
+ async _registerIpcListeners() {
+ await this._ensureAuthenticated();
+ this._ipc.registerStateListener(newState => {
+ log.debug('Got new state from backend', newState);
- this.sync();
- });
- });
+ const newStatus = this._securityStateToConnectionState(newState);
+ switch(newStatus) {
+ case 'connecting':
+ this._store.dispatch(connectionActions.connecting());
+ break;
+ case 'connected':
+ this._store.dispatch(connectionActions.connected());
+ break;
+ case 'disconnected':
+ this._store.dispatch(connectionActions.disconnected());
+ break;
+ }
+ this.sync();
+ });
}
_securityStateToConnectionState(backendState: BackendState): ConnectionState {