]> git.proxmox.com Git - mirror_novnc.git/commitdiff
Remove disconnectTimeout property
authorPierre Ossman <ossman@cendio.se>
Fri, 20 Oct 2017 11:26:49 +0000 (13:26 +0200)
committerPierre Ossman <ossman@cendio.se>
Thu, 9 Nov 2017 12:13:41 +0000 (13:13 +0100)
Callers should not need to modify this timeout.

core/rfb.js
docs/API.md
tests/test.rfb.js

index 882b52b5fac900fcec778055c2a995232f8195c9..39e02dd2fd0927ac6421463853289a97710fbc7a 100644 (file)
@@ -28,6 +28,9 @@ import { encodings, encodingName } from "./encodings.js";
 /*jslint white: false, browser: true */
 /*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) {
     this._target = target;
 
@@ -216,7 +219,6 @@ export default function RFB(target) {
 RFB.prototype = {
     // ===== PROPERTIES =====
 
-    disconnectTimeout: 3,
     dragViewport: false,
 
     _viewOnly: false,
@@ -548,7 +550,7 @@ RFB.prototype = {
                 this._disconnTimer = setTimeout(function () {
                     this._rfb_disconnect_reason = _("Disconnect timeout");
                     this._updateConnectionState('disconnected');
-                }.bind(this), this._disconnectTimeout * 1000);
+                }.bind(this), DISCONNECT_TIMEOUT * 1000);
                 break;
         }
     },
index 18e96068190945e52c3ac4a24156643146dc62a9..7b6596b924e50986562d4415f37f6498de2590de 100644 (file)
@@ -46,10 +46,6 @@ protocol stream.
   - Is a `boolean` indicating if the framebuffer is larger than the
     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*
   - Is an `Object` indicating which optional extensions are available
     on the server. Some methods may only be called if the corresponding
index b945fe2ef6364d4076509e6527e436a4b9f7597e..abe48a3fb27eb8f3e1b8a8bf5c18368d537a689f 100644 (file)
@@ -483,7 +483,7 @@ describe('Remote Frame Buffer Protocol Client', function() {
                 sinon.spy(client, '_updateConnectionState');
                 client._sock._websocket.close = function () {};  // explicitly don't call onclose
                 client._updateConnectionState('disconnecting');
-                this.clock.tick(client.disconnectTimeout * 1000);
+                this.clock.tick(3 * 1000);
                 expect(client._updateConnectionState).to.have.been.calledTwice;
                 expect(client._rfb_disconnect_reason).to.not.equal("");
                 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 () {
                 client._updateConnectionState('disconnecting');
-                this.clock.tick(client.disconnectTimeout * 500);
+                this.clock.tick(3 * 1000 / 2);
                 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');
             });