Revert "Fixed a race condition when attaching to an existing socket"
This reverts commit ef27628c6d
. By
bypassing setTimeout() it creates other race conditions so this is not
the proper fix for the issue.
This commit is contained in:
parent
84f102d6a9
commit
ae5f3f6909
13
core/rfb.js
13
core/rfb.js
|
@ -286,17 +286,8 @@ export default class RFB extends EventTargetMixin {
|
||||||
this._sock.on('error', e => Log.Warn("WebSocket on-error event"));
|
this._sock.on('error', e => Log.Warn("WebSocket on-error event"));
|
||||||
|
|
||||||
// Slight delay of the actual connection so that the caller has
|
// Slight delay of the actual connection so that the caller has
|
||||||
// time to set up callbacks.
|
// time to set up callbacks
|
||||||
// This it not possible when a pre-existing socket is passed in and is just opened.
|
setTimeout(this._updateConnectionState.bind(this, 'connecting'));
|
||||||
// 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');
|
|
||||||
}
|
|
||||||
|
|
||||||
Log.Debug("<< RFB.constructor");
|
Log.Debug("<< RFB.constructor");
|
||||||
|
|
||||||
|
|
|
@ -168,11 +168,6 @@ connection to a specified VNC server.
|
||||||
**`urlOrDataChannel`**
|
**`urlOrDataChannel`**
|
||||||
- A `DOMString` specifying the VNC server to connect to. This must be
|
- A `DOMString` specifying the VNC server to connect to. This must be
|
||||||
a valid WebSocket URL. This can also be a `WebSocket` or `RTCDataChannel`.
|
a valid WebSocket URL. This can also be a `WebSocket` or `RTCDataChannel`.
|
||||||
If a `DOMString` is supplied then the connection will be delayed until the next tick to
|
|
||||||
allow allow adding event listeners that fire on connection. If an existing object
|
|
||||||
is supplied then the connection logic happens the same tick. For instance if passing
|
|
||||||
in an existing open WebSocket then it will not be possible to listen for the `connect`
|
|
||||||
event. This is to avoid dropping data on a connection that has data as soon as its opened.
|
|
||||||
|
|
||||||
**`options`** *Optional*
|
**`options`** *Optional*
|
||||||
- An `Object` specifying extra details about how the connection
|
- An `Object` specifying extra details about how the connection
|
||||||
|
|
Loading…
Reference in New Issue