summaryrefslogtreecommitdiff
path: root/core/rfb.js
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2021-04-16 13:28:47 +0200
committerPierre Ossman <ossman@cendio.se>2021-04-16 13:28:47 +0200
commitae5f3f6909f1263c7a375f841ce685aa95224b60 (patch)
treef0f22271cb15774b24db9449519e75648175094f /core/rfb.js
parent84f102d6a9ffaf3972693d59bad5c6fddb6d7fb0 (diff)
downloadnovnc-ae5f3f6909f1263c7a375f841ce685aa95224b60.tar.gz
Revert "Fixed a race condition when attaching to an existing socket"
This reverts commit ef27628c6dff6120b0ed0d4728cc6e8a32b7be53. By bypassing setTimeout() it creates other race conditions so this is not the proper fix for the issue.
Diffstat (limited to 'core/rfb.js')
-rw-r--r--core/rfb.js13
1 files changed, 2 insertions, 11 deletions
diff --git a/core/rfb.js b/core/rfb.js
index f8eeb51..876255b 100644
--- a/core/rfb.js
+++ b/core/rfb.js
@@ -286,17 +286,8 @@ export default class RFB extends EventTargetMixin {
this._sock.on('error', e => Log.Warn("WebSocket on-error event"));
// Slight delay of the actual connection so that the caller has
- // time to set up callbacks.
- // This it not possible when a pre-existing socket is passed in and is just opened.
- // If the caller creates this object in the open() callback of a socket and there's
- // data pending doing it next tick causes a packet to be lost.
- // This is particularly noticable for RTCDataChannel's where the other end creates
- // the channel and the client, this end, gets notified it exists.
- if (typeof urlOrChannel === 'string') {
- setTimeout(this._updateConnectionState.bind(this, 'connecting'));
- } else {
- this._updateConnectionState('connecting');
- }
+ // time to set up callbacks
+ setTimeout(this._updateConnectionState.bind(this, 'connecting'));
Log.Debug("<< RFB.constructor");