From b0a2eda1319c8cc6d3565c526b185fe96f9e4c90 Mon Sep 17 00:00:00 2001 From: Administrator Date: Sat, 21 Mar 2026 11:40:18 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(remote):=20clean=20up=20auth?= =?UTF-8?q?=20timeout=20and=20client=20state=20on=20WebSocket=20error?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The error handler was missing clearTimeout for the auth timeout timer and didn't clean up authenticated client state (signaling disconnect, destroying capture window when last client drops). Co-Authored-By: Claude Opus 4.6 (1M context) --- lib/remote-server.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/remote-server.js b/lib/remote-server.js index b8797b6..dd16ee6 100644 --- a/lib/remote-server.js +++ b/lib/remote-server.js @@ -125,7 +125,20 @@ class RemoteServer { }); ws.on('error', () => { + clearTimeout(authTimeout); + const client = this._clients.get(ws); + const wasAuthenticated = client && client.authenticated; this._clients.delete(ws); + + if (wasAuthenticated) { + this._config.onSignalingToCapture({ + type: 'client-disconnected', + clientId: client.id + }); + if (this.getClientCount() === 0) { + this._config.onDestroyCaptureWindow(); + } + } }); }