Remove disconnectTimeout property
Callers should not need to modify this timeout.
This commit is contained in:
parent
002907d2ce
commit
68e09edcdc
|
@ -28,6 +28,9 @@ import { encodings, encodingName } from "./encodings.js";
|
||||||
/*jslint white: false, browser: true */
|
/*jslint white: false, browser: true */
|
||||||
/*global window, Util, Display, Keyboard, Mouse, Websock, Websock_native, Base64, DES, KeyTable, Inflator, XtScancode */
|
/*global window, Util, Display, Keyboard, Mouse, Websock, Websock_native, Base64, DES, KeyTable, Inflator, XtScancode */
|
||||||
|
|
||||||
|
// How many seconds to wait for a disconnect to finish
|
||||||
|
var DISCONNECT_TIMEOUT = 3;
|
||||||
|
|
||||||
export default function RFB(target) {
|
export default function RFB(target) {
|
||||||
this._target = target;
|
this._target = target;
|
||||||
|
|
||||||
|
@ -216,7 +219,6 @@ export default function RFB(target) {
|
||||||
RFB.prototype = {
|
RFB.prototype = {
|
||||||
// ===== PROPERTIES =====
|
// ===== PROPERTIES =====
|
||||||
|
|
||||||
disconnectTimeout: 3,
|
|
||||||
dragViewport: false,
|
dragViewport: false,
|
||||||
|
|
||||||
_viewOnly: false,
|
_viewOnly: false,
|
||||||
|
@ -548,7 +550,7 @@ RFB.prototype = {
|
||||||
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), DISCONNECT_TIMEOUT * 1000);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -46,10 +46,6 @@ protocol stream.
|
||||||
- Is a `boolean` indicating if the framebuffer is larger than the
|
- Is a `boolean` indicating if the framebuffer is larger than the
|
||||||
current canvas, i.e. it is being clipped.
|
current canvas, i.e. it is being clipped.
|
||||||
|
|
||||||
`disconnectTimeout`
|
|
||||||
- Is a `long` indicating how many seconds to wait for a disconnect
|
|
||||||
request to complete. Is set to `3` by default.
|
|
||||||
|
|
||||||
`capabilities` *Read only*
|
`capabilities` *Read only*
|
||||||
- Is an `Object` indicating which optional extensions are available
|
- Is an `Object` indicating which optional extensions are available
|
||||||
on the server. Some methods may only be called if the corresponding
|
on the server. Some methods may only be called if the corresponding
|
||||||
|
|
|
@ -483,7 +483,7 @@ describe('Remote Frame Buffer Protocol Client', function() {
|
||||||
sinon.spy(client, '_updateConnectionState');
|
sinon.spy(client, '_updateConnectionState');
|
||||||
client._sock._websocket.close = function () {}; // explicitly don't call onclose
|
client._sock._websocket.close = function () {}; // explicitly don't call onclose
|
||||||
client._updateConnectionState('disconnecting');
|
client._updateConnectionState('disconnecting');
|
||||||
this.clock.tick(client.disconnectTimeout * 1000);
|
this.clock.tick(3 * 1000);
|
||||||
expect(client._updateConnectionState).to.have.been.calledTwice;
|
expect(client._updateConnectionState).to.have.been.calledTwice;
|
||||||
expect(client._rfb_disconnect_reason).to.not.equal("");
|
expect(client._rfb_disconnect_reason).to.not.equal("");
|
||||||
expect(client._rfb_connection_state).to.equal("disconnected");
|
expect(client._rfb_connection_state).to.equal("disconnected");
|
||||||
|
@ -491,9 +491,9 @@ describe('Remote Frame Buffer Protocol Client', function() {
|
||||||
|
|
||||||
it('should not fail if Websock.onclose gets called within the disconnection timeout', function () {
|
it('should not fail if Websock.onclose gets called within the disconnection timeout', function () {
|
||||||
client._updateConnectionState('disconnecting');
|
client._updateConnectionState('disconnecting');
|
||||||
this.clock.tick(client.disconnectTimeout * 500);
|
this.clock.tick(3 * 1000 / 2);
|
||||||
client._sock._websocket.close();
|
client._sock._websocket.close();
|
||||||
this.clock.tick(client.disconnectTimeout * 500 + 1);
|
this.clock.tick(3 * 1000 / 2 + 1);
|
||||||
expect(client._rfb_connection_state).to.equal('disconnected');
|
expect(client._rfb_connection_state).to.equal('disconnected');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue