From c4b274ebb8cf7d6870db96cd9efdd6ebeee5b02a Mon Sep 17 00:00:00 2001 From: Samuel Mannehed Date: Tue, 8 Nov 2016 16:07:47 +0100 Subject: [PATCH] Move disconnect actions to a separate funciton Done in order to be consistent with connect() and to separate state actions from connection actions. --- core/rfb.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/core/rfb.js b/core/rfb.js index 5b1579a8..e253f0b2 100644 --- a/core/rfb.js +++ b/core/rfb.js @@ -385,6 +385,14 @@ 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 () { // reset state this._FBU.rects = 0; @@ -503,15 +511,12 @@ break; case 'disconnecting': - this._cleanup(); - this._sock.close(); // transitions to 'disconnected' + this._disconnect(); this._disconnTimer = setTimeout(function () { this._rfb_disconnect_reason = "Disconnect timeout"; this._updateConnectionState('disconnected'); }.bind(this), this._disconnectTimeout * 1000); - - this._print_stats(); break; default: