Separate state actions from connection actions

This commit is contained in:
Samuel Mannehed 2016-11-08 16:27:31 +01:00
parent c4b274ebb8
commit e48d1b254e
1 changed files with 2 additions and 3 deletions

View File

@ -361,6 +361,7 @@
_connect: function () { _connect: function () {
Util.Debug(">> RFB.connect"); Util.Debug(">> RFB.connect");
this._init_vars();
var uri; var uri;
if (typeof UsingSocketIO !== 'undefined') { if (typeof UsingSocketIO !== 'undefined') {
@ -373,6 +374,7 @@
Util.Info("connecting to " + uri); Util.Info("connecting to " + uri);
try { try {
// WebSocket.onopen transitions to the RFB init states
this._sock.open(uri, this._wsProtocols); this._sock.open(uri, this._wsProtocols);
} catch (e) { } catch (e) {
if (e.name === 'SyntaxError') { if (e.name === 'SyntaxError') {
@ -504,9 +506,6 @@
break; break;
case 'connecting': case 'connecting':
this._init_vars();
// WebSocket.onopen transitions to the RFB init states
this._connect(); this._connect();
break; break;