Split cleanup from closing the socket

This commit is contained in:
Samuel Mannehed 2016-09-19 00:32:48 +02:00
parent 3bb12056b1
commit 6c14514774
1 changed files with 4 additions and 6 deletions

View File

@ -246,7 +246,7 @@
}); });
this._init_vars(); this._init_vars();
this._cleanupSocket(); this._cleanup();
var rmode = this._display.get_render_mode(); var rmode = this._display.get_render_mode();
Util.Info("Using native WebSockets, render mode: " + rmode); Util.Info("Using native WebSockets, render mode: " + rmode);
@ -408,7 +408,7 @@
} }
}, },
_cleanupSocket: function () { _cleanup: function () {
if (this._msgTimer) { if (this._msgTimer) {
clearInterval(this._msgTimer); clearInterval(this._msgTimer);
this._msgTimer = null; this._msgTimer = null;
@ -424,8 +424,6 @@
this._display.clear(); this._display.clear();
} }
} }
this._sock.close();
}, },
/* /*
@ -494,8 +492,8 @@
break; break;
case 'disconnecting': case 'disconnecting':
// WebSocket.onclose transitions to 'disconnected' this._cleanup();
this._cleanupSocket(); 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";