From 6311bc93d0e47be9b7bbbcb57c57618078c7fbe6 Mon Sep 17 00:00:00 2001 From: Bartosz Leper Date: Mon, 4 Nov 2024 19:00:07 +0100 Subject: [PATCH] Allow TtyPlayer.stop to be called while still connecting --- web/packages/teleport/src/lib/term/ttyPlayer.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/web/packages/teleport/src/lib/term/ttyPlayer.js b/web/packages/teleport/src/lib/term/ttyPlayer.js index b231e83c1c7ce..87153d6ade295 100644 --- a/web/packages/teleport/src/lib/term/ttyPlayer.js +++ b/web/packages/teleport/src/lib/term/ttyPlayer.js @@ -243,6 +243,10 @@ export default class TtyPlayer extends Tty { this.cancelTimeUpdate(); this._setPlayerStatus(StatusEnum.PAUSED); + if (this.webSocket.readyState !== WebSocket.OPEN) { + return; + } + const buffer = new ArrayBuffer(4); const dv = new DataView(buffer); dv.setUint8(0, messageTypePlayPause);