diff --git a/core/rfb.js b/core/rfb.js index 578a8984..18b19156 100644 --- a/core/rfb.js +++ b/core/rfb.js @@ -402,7 +402,7 @@ export default class RFB extends EventTargetMixin { sendCredentials(creds) { this._rfbCredentials = creds; - setTimeout(this._initMsg.bind(this), 0); + this._resumeAuthentication(); } sendCtrlAltDel() { @@ -1661,7 +1661,7 @@ export default class RFB extends EventTargetMixin { this._rfbCredentials.ardCredentials = encrypted; this._rfbCredentials.ardPublicKey = clientPublicKey; - setTimeout(this._initMsg.bind(this), 0); + this._resumeAuthentication(); } _negotiateTightUnixAuth() { @@ -2052,6 +2052,14 @@ export default class RFB extends EventTargetMixin { } } + // Resume authentication handshake after it was paused for some + // reason, e.g. waiting for a password from the user + _resumeAuthentication() { + // We use setTimeout() so it's run in its own context, just like + // it originally did via the WebSocket's event handler + setTimeout(this._initMsg.bind(this), 0); + } + _handleSetColourMapMsg() { Log.Debug("SetColorMapEntries");