From b505d68f562cadc66c3475ff6c550b333e05152b Mon Sep 17 00:00:00 2001 From: Moepchi Date: Thu, 10 Sep 2026 20:53:04 +0000 Subject: [PATCH] publish: drop a queued request when the client leaves notifystreamclientleft only removed connected viewers, so a request that was still waiting for a decision outlived the person who made it - the row stayed in the panel and approving it would have opened a connection to a client that is gone. Leaving while pending is not exotic: it is what closing TS6, or giving up on "waiting for access", looks like from here. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01Hu2cuPLqpuKVfd9wWFFakU --- web/src/publish.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/web/src/publish.ts b/web/src/publish.ts index 11bdb46..390f8fc 100644 --- a/web/src/publish.ts +++ b/web/src/publish.ts @@ -219,8 +219,6 @@ export class StreamPublisher { // is_remove=1 is how TS6 says "stop watching"; the same notify carries it. if (args.is_remove === "1") { this.dropViewer(clid); - this.pending.delete(clid); - this.notifyPending(); return; } if (this.viewers.has(clid) || this.pending.has(clid)) return; @@ -421,6 +419,11 @@ export class StreamPublisher { } private dropViewer(clid: number): void { + // Someone can also leave while their request is still queued - by closing + // TS6, or by giving up on "waiting for access". The row has to go with + // them, or the user is left approving a viewer who is no longer there. + if (this.pending.delete(clid)) this.notifyPending(); + const viewer = this.viewers.get(clid); if (!viewer) return; this.viewers.delete(clid);