Abstract resuming the authentication

We now do this in multiple places, so make sure things are handled the
same way in all cases.
This commit is contained in:
Pierre Ossman 2022-08-18 14:15:36 +02:00
parent 8a7089c0c6
commit 05d68e118d

View File

@ -402,7 +402,7 @@ export default class RFB extends EventTargetMixin {
sendCredentials(creds) { sendCredentials(creds) {
this._rfbCredentials = creds; this._rfbCredentials = creds;
setTimeout(this._initMsg.bind(this), 0); this._resumeAuthentication();
} }
sendCtrlAltDel() { sendCtrlAltDel() {
@ -1661,7 +1661,7 @@ export default class RFB extends EventTargetMixin {
this._rfbCredentials.ardCredentials = encrypted; this._rfbCredentials.ardCredentials = encrypted;
this._rfbCredentials.ardPublicKey = clientPublicKey; this._rfbCredentials.ardPublicKey = clientPublicKey;
setTimeout(this._initMsg.bind(this), 0); this._resumeAuthentication();
} }
_negotiateTightUnixAuth() { _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() { _handleSetColourMapMsg() {
Log.Debug("SetColorMapEntries"); Log.Debug("SetColorMapEntries");