Move disconnect actions to a separate funciton
Done in order to be consistent with connect() and to separate state actions from connection actions.
This commit is contained in:
parent
376864d6d1
commit
c4b274ebb8
13
core/rfb.js
13
core/rfb.js
|
@ -385,6 +385,14 @@
|
||||||
Util.Debug("<< RFB.connect");
|
Util.Debug("<< RFB.connect");
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_disconnect: function () {
|
||||||
|
Util.Debug(">> RFB.disconnect");
|
||||||
|
this._cleanup();
|
||||||
|
this._sock.close();
|
||||||
|
this._print_stats();
|
||||||
|
Util.Debug("<< RFB.disconnect");
|
||||||
|
},
|
||||||
|
|
||||||
_init_vars: function () {
|
_init_vars: function () {
|
||||||
// reset state
|
// reset state
|
||||||
this._FBU.rects = 0;
|
this._FBU.rects = 0;
|
||||||
|
@ -503,15 +511,12 @@
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'disconnecting':
|
case 'disconnecting':
|
||||||
this._cleanup();
|
this._disconnect();
|
||||||
this._sock.close(); // transitions to 'disconnected'
|
|
||||||
|
|
||||||
this._disconnTimer = setTimeout(function () {
|
this._disconnTimer = setTimeout(function () {
|
||||||
this._rfb_disconnect_reason = "Disconnect timeout";
|
this._rfb_disconnect_reason = "Disconnect timeout";
|
||||||
this._updateConnectionState('disconnected');
|
this._updateConnectionState('disconnected');
|
||||||
}.bind(this), this._disconnectTimeout * 1000);
|
}.bind(this), this._disconnectTimeout * 1000);
|
||||||
|
|
||||||
this._print_stats();
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in New Issue