From 6c14514774dc0304d7ae1da17a05cc062305d60e Mon Sep 17 00:00:00 2001 From: Samuel Mannehed Date: Mon, 19 Sep 2016 00:32:48 +0200 Subject: [PATCH] Split cleanup from closing the socket --- core/rfb.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/core/rfb.js b/core/rfb.js index eb5f29b5..ca173eae 100644 --- a/core/rfb.js +++ b/core/rfb.js @@ -246,7 +246,7 @@ }); this._init_vars(); - this._cleanupSocket(); + this._cleanup(); var rmode = this._display.get_render_mode(); Util.Info("Using native WebSockets, render mode: " + rmode); @@ -408,7 +408,7 @@ } }, - _cleanupSocket: function () { + _cleanup: function () { if (this._msgTimer) { clearInterval(this._msgTimer); this._msgTimer = null; @@ -424,8 +424,6 @@ this._display.clear(); } } - - this._sock.close(); }, /* @@ -494,8 +492,8 @@ break; case 'disconnecting': - // WebSocket.onclose transitions to 'disconnected' - this._cleanupSocket(); + this._cleanup(); + this._sock.close(); // transitions to 'disconnected' this._disconnTimer = setTimeout(function () { this._rfb_disconnect_reason = "Disconnect timeout";