Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -190,16 +190,16 @@ class DriverRemoteConnection extends RemoteConnection {
* @return {Promise}
*/
close() {
if (this._closePromise) {
return this._closePromise;
}
this._closePromise = new Promise(resolve => {
this._ws.on('close', function () {
this.isOpen = false;
resolve();
if (!this._closePromise) {
this._closePromise = new Promise(resolve => {
this._ws.on('close', function () {
this.isOpen = false;
resolve();
});
this._ws.close();
});
this._ws.close();
});
}
return this._closePromise;
}
}

Expand All @@ -226,4 +226,4 @@ const bufferFromString = (Int8Array.from !== Buffer.from && Buffer.from) || func
return new Buffer(text, 'utf8');
};

module.exports = DriverRemoteConnection;
module.exports = DriverRemoteConnection;